Feature to share news/posts/articles#162
Conversation
|
@idebenone, could you please include both the title and the URL when sharing content, like this: it would be helpful if you could show the title before sharing so that users can have some context for what they are sharing. Thank you |
|
Hey @medyo ! |
|
|
new ui of the modal matching the settings modal. |
| }: CardItemWithActionsProps) => { | ||
| const [showModal, setShowModal] = useState(false) | ||
| const [link, setLink] = useState({}) | ||
| const [data, setData] = useState({}) |
There was a problem hiding this comment.
data is too generic, please use a name like socialShareData or socialSharePayload
| const sharingButtons = [ | ||
| { component: EmailShareButton, icon: FaMailBulk, title: 'Mail' }, | ||
| { component: FacebookShareButton, icon: FaFacebookSquare, title: 'Facebook' }, | ||
| { component: TwitterShareButton, icon: FaTwitterSquare, title: 'Twitter' }, | ||
| { component: RedditShareButton, icon: FaRedditSquare, title: 'Reddit' }, | ||
| { component: LinkedinShareButton, icon: FaLinkedinIn, title: 'Linkedin' }, | ||
| { component: TelegramShareButton, icon: FaTelegram, title: 'Telegram' }, | ||
| { component: WhatsappShareButton, icon: FaWhatsappSquare, title: 'Whatsapp' }, | ||
| ] |
There was a problem hiding this comment.
Please you use colourful icons, they look much better
|
@idebenone the |
|
@medyo |
|
@idebenone I couldn't merge your branch, it has some conflicts with the |
|
Hey @medyo |
yeah, conflicts can be really draining, but you'll improve through practice. I've given your code a test run, and it seems that the bookmark icon is no longer displaying.
|
|
I think it's a CSS issue, @victor-duarte can you take a look at this? |
|
@medyo |
|
I think we need a scalable way to allow adding more than 2 buttons. |
|
👋🏻 Note: When enabling tab navigation an odd scroll was displaying when focusing on the CTA due to the container being outside the card and animating into the card. The animation was applied on the button instead and the container moved within the card preventing the layout shift. My 2 cents would be to go with a simple solution that allows having the 2 buttons and if in the future a third button is needed maybe looking into alternative card designs. I am no designer but maybe something the line X or instagram. Suggestion
option-1.movoption-2.mov |
| code { | ||
| font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Revert and update touched files.
- For consistency leave an empty line on the files (might be due to a local config in the IDE that the lines are being stripped out)
|
|
||
| {cardItem} | ||
| <div className={`blockActions ${isBookmarked ? 'active' : ''} `}> | ||
| <button |
There was a problem hiding this comment.
Add aria-label="Bookmark item".
| onClick={onBookmarkClick}> | ||
| {!isBookmarked ? <BiBookmarkPlus /> : <BiBookmarkMinus />} | ||
| </button> | ||
| <button className={`blockActionButton `} onClick={handleOpenModal}> |
There was a problem hiding this comment.
Add aria-label="Open share modal"
|
|
||
| const handleOpenModal = () => { | ||
| setShowModal(!showModal) | ||
| setShareData({ title: item.title, link: item.url, source: source }) |
There was a problem hiding this comment.
Suggestion: avoid the. double state:
- Use the
shareDatato handle the modal toggle- Reset the data when the modal closes
I don't know much about react best practices but it seems the double state is not needed since the modal depends on if data is selected or not.
|
|
||
| .shareBody p { | ||
| font-size: 15px; | ||
| line-height: 1px; |
There was a problem hiding this comment.
Adjust element margins instead of setting line height to 1px
| overlayClassName="Overlay"> | ||
| <div className="modalHeader"> | ||
| <h1 className="modalTitle">Share</h1> | ||
| <button className="modalCloseBtn" onClick={handleCloseModal}> |
There was a problem hiding this comment.
Add aria-label="Close share modal"
| <h3>{shareData.title}</h3> | ||
| <div className="shareLink"> | ||
| <input type="text" value={shareData.link} disabled /> | ||
| <button onClick={copyLink}> |
There was a problem hiding this comment.
Add aria-label="Copy source url to clipboard"
| ariaHideApp={false} | ||
| shouldCloseOnEsc={true} | ||
| shouldCloseOnOverlayClick={true} | ||
| shouldFocusAfterRender={false} |
There was a problem hiding this comment.
Set this to true to improve a11y
- Will allow the user to reach the modal if navigating with keyboard and close the modal when hitting
ESC - Would suggest doing this on other modals also
| gap: 20px; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { |
There was a problem hiding this comment.
Suggestion: if you follow a mobile first approach you could trim down a couple of lines:
.shareModal {
background-color: var(--card-background-color);
bottom: 0;
box-shadow: 0 0 20px #00000052;
box-sizing: border-box;
left: 0;
padding-bottom: 90px;
padding: 12px 12px 90px;
position: absolute;
width: 100%;
}
...
@media (min-width: 768px) {
.shareModal {
border-radius: 10px;
bottom: auto;
left: 50%;
padding-bottom: 12px;
top: 50%;
transform: translate(-50%, -50%);
width: 450px;
}
.shareOptions {
gap: 20px;
}
}
|
|
||
| .shareLink { | ||
| display: flex; | ||
| flex-direction: row; |
There was a problem hiding this comment.
flex-row is the default direction, it can be removed.
|
👋🏻 @medyo if permission are granted in this branch/PR I can apply the changes of the comments above. cc: @idebenone |
|
@victor-duarte I don't see any setting to allow that permission on my side. |
|
@idebenone, if a hand is needed please let me know if you are able to grant permissions to work on the PR. |
Hey @victor-duarte |
|
added all the aria-labels and made other css related changes that you had suggested related to shareModal |
|
@medyo Could you please review my last commit? |
|
@idebenone "To address issues with smaller post rows, let's switch the flex direction to 'row' with some gaps, The current implementation isn't fitting well.
|
|
position: absolute removed. Pushed margin on left and bottom to give a nice lift to the buttons. Also changed the order of the elements. With bookmark button as the first element from left, if a post is saved it will look odd when the button is active. |
|
Yes, this looks much better. Feel free to commit the new changes |
|
@medyo Done 👍. |
|
Thanks a lot @idebenone, You did great! |
* Feature to share news/posts/articles (#162) * feature to share news/posts/articles * added title and source to share model * added title, removed redundancy of props * colorful icons & title prop added to button * css updated * css changes * fixed block-action-btns * Merge branch 'shareFeature' of github.com:idebenone/hackertab.dev * fix yarn.lock * persist fetched queries in localstorage * improve the share modal UI * track copy and share events * tag hackertabdev twitter account * add missing api url --------- Co-authored-by: Vineeth <[email protected]>








Added an option to share news on the card.