Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[deploy] Add comment subscription component to article page (#7205)
* wip * Right aligned the comment subscription panel. * Cleaned up the comment area on the article page so it uses crayon margin classes. * Updated tests * Removed old UI for comment subscriptions. * Made Discussion text bigger and bolder. * Fixed some layout issues as per PR comments. * Fixed some layout issues as per PR comments. * Updated Storybook stories, tests and snapshots * wip * Everything works now, just need to integrate snackbar. * Removed setTimeout I was debugging with. * Using the new utilities/http/request utility now. * Added the <SnackbarPoller /> * Now when unsubscribed, the subscription type resets to all comments. * Removed overflow hidden from .home CSS class so comment subscription component displays properly. * Now unsuccessful subscribes/unsubscribes error properly. * Changed button text from Done to Subscribe * Merged the <SnackbarPoller /> component into the <Snackbar /> component. * Fixed a propType issue. * Fixed a test. * Removed snackbar tests for now. Need to figure out polling in tests. * Now comment subscription component is only loaded for logged on users. * Added a comment. * Updated some storybook stories. * Fixed a small formatting issue. * Reduced snackbar item lifespans to 3 seconds. * Extracted <CogIcon /> to it's own file because other features are going to need it. * Added some Storybook stories and tests for the <CogIcon /> component. * Revert "Extracted <CogIcon /> to it's own file because other features are going to need it." This reverts commit b30406a. * Put back <CogIcon /> component. * Added some error handling if the component doesn't load. * Moving some things around. * Rename the article pack file. * Changed wording from "article" to "post". * Fixed false negative CSS issue. It was a dangling div tag. * Add the option to add an optional close button to snackbar items. * Fixed z-index of subscription type options panel so it is always visible on mobile. * Reworked the comment subsciption utilities a bit. * Added test for comment subscription utilities. * Fixed a broken test from a refactor. * Added more tests for comment subscription utiltities. * Fixed comments footer bottom padding. * Fixed issue with stale find in comment subscription test. * Update app/javascript/packs/articlePage.jsx Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com> * Update app/assets/stylesheets/article-show.scss Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com> * Changed close button wording to Dismiss. * Fixed padding to use utility variable instead. * Added missing import for SASS file. Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
- Loading branch information
1 parent
6229075
commit a71d78d
Showing
27 changed files
with
832 additions
and
542 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
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
56 changes: 52 additions & 4 deletions
56
app/javascript/CommentSubscription/__stories__/CommentSubscription.stories.jsx
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 |
|---|---|---|
| @@ -1,14 +1,62 @@ | ||
| import { h } from 'preact'; | ||
| import { action } from '@storybook/addon-actions'; | ||
| import { CommentSubscription } from '../CommentSubscription'; | ||
| import { withKnobs, select } from '@storybook/addon-knobs/react'; | ||
| import { | ||
| CommentSubscription, | ||
| COMMENT_SUBSCRIPTION_TYPE, | ||
| } from '../CommentSubscription'; | ||
|
|
||
| export default { | ||
| title: 'App Components/Comment Subscription', | ||
| decorators: [withKnobs], | ||
| }; | ||
|
|
||
| export const Default = () => ( | ||
| const commonProps = { | ||
| onSubscribe: action('subscribed'), | ||
| onUnsubscribe: action('unsubscribed'), | ||
| }; | ||
|
|
||
| export const Unsubscribed = () => ( | ||
| <CommentSubscription | ||
| {...commonProps} | ||
| subscriptionType={select( | ||
| 'subscriptionType', | ||
| COMMENT_SUBSCRIPTION_TYPE, | ||
| COMMENT_SUBSCRIPTION_TYPE.NOT_SUBSCRIBED, | ||
| )} | ||
| /> | ||
| ); | ||
|
|
||
| Unsubscribed.story = { | ||
| name: 'unsubscribed', | ||
| }; | ||
|
|
||
| export const Subscribed = () => ( | ||
| <CommentSubscription | ||
| onSubscribe={action('subscribed')} | ||
| onUnsubscribe={action('unsubscribed')} | ||
| {...commonProps} | ||
| subscriptionType={select( | ||
| 'subscriptionType', | ||
| COMMENT_SUBSCRIPTION_TYPE, | ||
| COMMENT_SUBSCRIPTION_TYPE.ALL, | ||
| )} | ||
| /> | ||
| ); | ||
|
|
||
| Subscribed.story = { | ||
| name: 'subscribed', | ||
| }; | ||
|
|
||
| export const SubscribedButNotDefault = () => ( | ||
| <CommentSubscription | ||
| {...commonProps} | ||
| subscriptionType={select( | ||
| 'subscriptionType', | ||
| COMMENT_SUBSCRIPTION_TYPE, | ||
| COMMENT_SUBSCRIPTION_TYPE.AUTHOR, | ||
| )} | ||
| /> | ||
| ); | ||
|
|
||
| SubscribedButNotDefault.story = { | ||
| name: 'subscribed (with comment type other than the default', | ||
| }; |
Oops, something went wrong.