0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Added wip context menu

This commit is contained in:
Simon Backx 2022-07-05 17:32:43 +02:00
parent 6079142f54
commit f839931548
3 changed files with 83 additions and 20 deletions

View file

@ -1,32 +1,58 @@
import Avatar from './Avatar';
import {formatRelativeTime} from '../utils/helpers';
import {ReactComponent as MoreIcon} from '../images/icons/more.svg';
import React from 'react';
import AppContext from '../AppContext';
import AuthorContextMenu from './modals/AuthorContextMenu';
function Comment(props) {
const comment = props.comment;
class Comment extends React.Component {
static contextType = AppContext;
const html = {__html: comment.html};
constructor(props) {
super(props);
this.state = {
isContextMenuOpen: false
};
return (
<div className="flex mb-4">
<div>
<div className="flex mb-2 space-x-4 justify-start items-center">
<Avatar />
this.toggleContextMenu = this.toggleContextMenu.bind(this);
}
<div>
<h4 className="text-lg font-sans font-bold mb-1 tracking-tight dark:text-neutral-300">{comment.member.name}</h4>
<h6 className="text-xs text-neutral-400 font-sans">{formatRelativeTime(comment.created_at)}</h6>
toggleContextMenu() {
this.setState(state => ({
isContextMenuOpen: !state.isContextMenuOpen
}));
}
render() {
const comment = this.props.comment;
const html = {__html: comment.html};
return (
<div className="flex mb-4">
<div>
<div className="flex mb-2 space-x-4 justify-start items-center">
<Avatar />
<div>
<h4 className="text-lg font-sans font-bold mb-1 tracking-tight dark:text-neutral-300">{comment.member.name}</h4>
<h6 className="text-xs text-neutral-400 font-sans">{formatRelativeTime(comment.created_at)}</h6>
</div>
{/* <h6 className="text-sm text-neutral-400 font-sans">{comment.member.bio}</h6> */}
{/* <div className="text-sm text-neutral-400 font-sans font-normal">
{formatRelativeTime(comment.created_at)}
</div> */}
</div>
{/* <h6 className="text-sm text-neutral-400 font-sans">{comment.member.bio}</h6> */}
{/* <div className="text-sm text-neutral-400 font-sans font-normal">
{formatRelativeTime(comment.created_at)}
</div> */}
</div>
<div className="ml-14 mb-4 font-sans leading-normal dark:text-neutral-300">
<p dangerouslySetInnerHTML={html} className="whitespace-pre-wrap"></p>
<div className="ml-14 mb-4 font-sans leading-normal dark:text-neutral-300">
<p dangerouslySetInnerHTML={html} className="whitespace-pre-wrap"></p>
</div>
{/*</div>button><MoreIcon className='gh-comments-icon gh-comments-icon-more' /></button>
{this.state.isContextMenuOpen ? <AuthorContextMenu /> : null}*/}
</div>
</div>
</div>
);
);
}
}
export default Comment;

View file

@ -0,0 +1,32 @@
import React from 'react';
import AppContext from '../../AppContext';
class Form extends React.Component {
static contextType = AppContext;
constructor(props) {
super(props);
this.state = {};
this.deleteComment = this.deleteComment.bind(this);
}
deleteComment(event) {
// todo
}
render() {
return (
<div className='bg-white absolute'>
<button>
Edit
</button>
<button onClick={this.deleteComment}>
Delete
</button>
</div>
);
}
}
export default Form;

View file

@ -0,0 +1,5 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="5" cy="10" r="1.5" fill="black"/>
<circle cx="10" cy="10" r="1.5" fill="black"/>
<circle cx="15" cy="10" r="1.5" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B