forked from Podcastindex-org/web-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancements Podcastindex-org#240, Podcastindex-org#233 Comments repl…
…y and other actions This commit implements Podcastindex-org#240 and initial support for Podcastindex-org#233. A menu is added to comments that support initiating the following actions: - Reply to post - currently just navigates to the post in it is original system - Copy link to post - Open in original site - opens the post in its original system at another tab - Follow author of the post - currently just navigates to the profile of the author on its original system This commit is based on nathangathright/comment-thread-mockup@6b2f716 Related issues: - Podcastindex-org#240 - Podcastindex-org#233 Co-authored-by: Nathan Gathright <[email protected]>
- Loading branch information
1 parent
de423ff
commit 40e8e99
Showing
4 changed files
with
158 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as React from 'react' | ||
|
||
import './styles.scss' | ||
|
||
interface ICommentMenuProps { | ||
/** | ||
* URL of the comment | ||
*/ | ||
url: string, | ||
commenterUrl: string, | ||
commenterAccount: string, | ||
} | ||
|
||
interface ICommentMenuState { | ||
|
||
} | ||
|
||
class CommentMenu extends React.PureComponent<ICommentMenuProps, ICommentMenuState> { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
|
||
} | ||
} | ||
|
||
onClickCopyLink(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) { | ||
e.preventDefault(); | ||
navigator.clipboard.writeText(this.props.url); | ||
|
||
// Some form of "toast message" would be better, but I don't | ||
// think something like that is already implemented, meanwhile, | ||
// we use an alert, it is ugly, but it show the user there was | ||
// a reaction. | ||
alert('Link to post copied'); | ||
} | ||
|
||
render(): React.ReactNode { | ||
return ( | ||
<menu> | ||
<a href={this.props.url}>Reply to this post</a> | ||
<a href={this.props.url} onClick={(e) => this.onClickCopyLink(e)}>Copy link to this post</a> | ||
<a href={this.props.url} target='_blank'>Open in original site</a> | ||
<a href={this.props.commenterUrl}>Follow {this.props.commenterAccount}</a> | ||
</menu> | ||
) | ||
} | ||
} | ||
|
||
export default CommentMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.context-menu { | ||
all: unset; | ||
position: relative; | ||
} | ||
|
||
.context-menu svg { | ||
display: block; | ||
} | ||
|
||
.context-menu menu { | ||
position: absolute; | ||
top: 100%; | ||
right: 0; | ||
display: flex; | ||
flex-direction: column; | ||
background: #FFF; | ||
margin: 0; | ||
padding: .75rem; | ||
z-index: 1; | ||
border-radius: .25rem; | ||
box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25); | ||
} | ||
|
||
.context-menu menu a { | ||
white-space: nowrap; | ||
text-decoration: none; | ||
line-height: 2; | ||
} | ||
|
||
.dialog-homeinstance { | ||
border: 1px solid rgba(0, 0, 0, 0.25); | ||
border-radius: 0.5rem; | ||
box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25); | ||
width: calc((100% - 6px) - 2em); | ||
max-width: 28rem; | ||
} | ||
|
||
.dialog-homeinstance form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.5rem; | ||
margin: 0; | ||
} | ||
|
||
.dialog-homeinstance input { | ||
padding: 0.5rem; | ||
} | ||
|
||
.dialog-homeinstance menu { | ||
display: flex; | ||
flex-wrap: wrap; | ||
flex-direction: row; | ||
justify-content: flex-end; | ||
gap: .5rem; | ||
margin: 1.5rem 0 0 0; | ||
} | ||
|
||
.dialog-homeinstance button { | ||
border: none; | ||
padding: .5rem; | ||
border-radius: 4px; | ||
min-width: 4.5rem; | ||
background-color: #2962ff; | ||
font-size: 0.875rem; | ||
font-weight: 500; | ||
letter-spacing: .25px; | ||
line-height: 1rem; | ||
outline: none; | ||
color: #FFF; | ||
} | ||
|
||
.dialog-homeinstance button:hover { | ||
background-color: #2F7DE2; | ||
} | ||
|
||
.dialog-homeinstance button[type="reset"] { | ||
background-color: transparent; | ||
box-shadow: inset 0 0 0 1px #DADCE0; | ||
color: #2962ff; | ||
} | ||
|
||
.dialog-homeinstance button[type="reset"]:hover { | ||
background-color: #EAF2FD; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters