diff --git a/src/core/client/auth/test/__snapshots__/signIn.spec.tsx.snap b/src/core/client/auth/test/__snapshots__/signIn.spec.tsx.snap index cb01d2c1b..898850de7 100644 --- a/src/core/client/auth/test/__snapshots__/signIn.spec.tsx.snap +++ b/src/core/client/auth/test/__snapshots__/signIn.spec.tsx.snap @@ -34,11 +34,11 @@ exports[`accepts correct password 1`] = ` value="" />
@@ -180,11 +180,11 @@ exports[`accepts valid email 1`] = ` value="" />
@@ -290,11 +290,11 @@ exports[`checks for invalid email 1`] = ` value="invalid-email" />
@@ -321,11 +321,11 @@ exports[`checks for invalid email 1`] = ` value="" />
@@ -546,11 +546,11 @@ exports[`shows error when submitting empty form 1`] = ` value="" />
@@ -577,11 +577,11 @@ exports[`shows error when submitting empty form 1`] = ` value="" />
diff --git a/src/core/client/auth/test/__snapshots__/signUp.spec.tsx.snap b/src/core/client/auth/test/__snapshots__/signUp.spec.tsx.snap index 6293da7d8..4b0ee2dc7 100644 --- a/src/core/client/auth/test/__snapshots__/signUp.spec.tsx.snap +++ b/src/core/client/auth/test/__snapshots__/signUp.spec.tsx.snap @@ -34,11 +34,11 @@ exports[`accepts correct password 1`] = ` value="" />
@@ -70,11 +70,11 @@ exports[`accepts correct password 1`] = ` value="" />
@@ -124,11 +124,11 @@ exports[`accepts correct password 1`] = ` value="" />
@@ -215,11 +215,11 @@ exports[`accepts correct password confirmation 1`] = ` value="" />
@@ -251,11 +251,11 @@ exports[`accepts correct password confirmation 1`] = ` value="" />
@@ -287,11 +287,11 @@ exports[`accepts correct password confirmation 1`] = ` value="" />
@@ -318,11 +318,11 @@ exports[`accepts correct password confirmation 1`] = ` value="testtest" />
@@ -432,11 +432,11 @@ exports[`accepts valid email 1`] = ` value="" />
@@ -468,11 +468,11 @@ exports[`accepts valid email 1`] = ` value="" />
@@ -499,11 +499,11 @@ exports[`accepts valid email 1`] = ` value="" />
@@ -590,11 +590,11 @@ exports[`accepts valid username 1`] = ` value="" />
@@ -649,11 +649,11 @@ exports[`accepts valid username 1`] = ` value="" />
@@ -680,11 +680,11 @@ exports[`accepts valid username 1`] = ` value="" />
@@ -771,11 +771,11 @@ exports[`checks for invalid characters in username 1`] = ` value="" />
@@ -807,11 +807,11 @@ exports[`checks for invalid characters in username 1`] = ` value="$%$§$%$§%" />
@@ -843,11 +843,11 @@ exports[`checks for invalid characters in username 1`] = ` value="" />
@@ -874,11 +874,11 @@ exports[`checks for invalid characters in username 1`] = ` value="" />
@@ -965,11 +965,11 @@ exports[`checks for invalid email 1`] = ` value="invalid-email" />
@@ -1001,11 +1001,11 @@ exports[`checks for invalid email 1`] = ` value="" />
@@ -1037,11 +1037,11 @@ exports[`checks for invalid email 1`] = ` value="" />
@@ -1068,11 +1068,11 @@ exports[`checks for invalid email 1`] = ` value="" />
@@ -1159,11 +1159,11 @@ exports[`checks for too long username 1`] = ` value="" />
@@ -1195,11 +1195,11 @@ exports[`checks for too long username 1`] = ` value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" />
@@ -1231,11 +1231,11 @@ exports[`checks for too long username 1`] = ` value="" />
@@ -1262,11 +1262,11 @@ exports[`checks for too long username 1`] = ` value="" />
@@ -1353,11 +1353,11 @@ exports[`checks for too short password 1`] = ` value="" />
@@ -1389,11 +1389,11 @@ exports[`checks for too short password 1`] = ` value="" />
@@ -1425,11 +1425,11 @@ exports[`checks for too short password 1`] = ` value="pass" />
@@ -1456,11 +1456,11 @@ exports[`checks for too short password 1`] = ` value="" />
@@ -1547,11 +1547,11 @@ exports[`checks for too short username 1`] = ` value="" />
@@ -1583,11 +1583,11 @@ exports[`checks for too short username 1`] = ` value="u" />
@@ -1619,11 +1619,11 @@ exports[`checks for too short username 1`] = ` value="" />
@@ -1650,11 +1650,11 @@ exports[`checks for too short username 1`] = ` value="" />
@@ -1741,11 +1741,11 @@ exports[`checks for wrong password confirmation 1`] = ` value="" />
@@ -1777,11 +1777,11 @@ exports[`checks for wrong password confirmation 1`] = ` value="" />
@@ -1813,11 +1813,11 @@ exports[`checks for wrong password confirmation 1`] = ` value="" />
@@ -1844,11 +1844,11 @@ exports[`checks for wrong password confirmation 1`] = ` value="not-matching" />
@@ -2077,11 +2077,11 @@ exports[`shows error when submitting empty form 1`] = ` value="" />
@@ -2113,11 +2113,11 @@ exports[`shows error when submitting empty form 1`] = ` value="" />
@@ -2149,11 +2149,11 @@ exports[`shows error when submitting empty form 1`] = ` value="" />
@@ -2180,11 +2180,11 @@ exports[`shows error when submitting empty form 1`] = ` value="" />
diff --git a/src/core/client/stream/test/__snapshots__/loadMore.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/loadMore.spec.tsx.snap index 1d82d7bb9..19c1b6129 100644 --- a/src/core/client/stream/test/__snapshots__/loadMore.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/loadMore.spec.tsx.snap @@ -325,278 +325,15 @@ exports[`renders comment stream 1`] = `
-
-
-
- - -
-
- -
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
-
- - Lukas - - -
-
-
- -
-
-
-
- -
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (5:6) +4: ) { +5: me(clientAuthRevision: $authRevision) { + ^ +6: ...StreamContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/permalinkView.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/permalinkView.spec.tsx.snap index 19ba2686a..89eba3ff5 100644 --- a/src/core/client/stream/test/__snapshots__/permalinkView.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/permalinkView.spec.tsx.snap @@ -4,78 +4,15 @@ exports[`renders permalink view 1`] = `
-
- - Show all comments - -
-
-
- - Markus - - -
-
-
- -
-
-
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (6:6) +5: ) { +6: me(clientAuthRevision: $authRevision) { + ^ +7: ...PermalinkViewContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap index b7f4fc521..d5c3a172c 100644 --- a/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap @@ -5,7 +5,14 @@ exports[`renders permalink view with unknown asset 1`] = ` className="Flex-root App-root Flex-flex Flex-justifyCenter" >
- Asset not found + Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (6:6) +5: ) { +6: me(clientAuthRevision: $authRevision) { + ^ +7: ...PermalinkViewContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap index 931557b1a..39cd1503f 100644 --- a/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap @@ -4,30 +4,15 @@ exports[`renders permalink view with unknown comment 1`] = `
-
- - Show all comments - -

- Comment not found -

+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (6:6) +5: ) { +6: me(clientAuthRevision: $authRevision) { + ^ +7: ...PermalinkViewContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/postComment.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/postComment.spec.tsx.snap index dacf75add..97fd167f7 100644 --- a/src/core/client/stream/test/__snapshots__/postComment.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/postComment.spec.tsx.snap @@ -718,301 +718,15 @@ exports[`renders comment stream 1`] = `
-
-
-
-
-
- Signed in as - - Markus - - . -
-
- - Not you?  - - -
-
-
-
-
-
- -
-
-
- - - -
- -
-
-
-
-
-
- - Powered by - - ⁨The Coral Project⁩ - - -
- -
-
- -
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
-
- - Lukas - - -
-
-
- -
-
-
-
-
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (5:6) +4: ) { +5: me(clientAuthRevision: $authRevision) { + ^ +6: ...StreamContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/postReply.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/postReply.spec.tsx.snap index 63360eccb..a7fce87a7 100644 --- a/src/core/client/stream/test/__snapshots__/postReply.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/postReply.spec.tsx.snap @@ -1279,301 +1279,15 @@ exports[`renders comment stream 1`] = `
-
-
-
-
-
- Signed in as - - Markus - - . -
-
- - Not you?  - - -
-
-
-
-
-
- -
-
-
- - - -
- -
-
-
-
-
-
- - Powered by - - ⁨The Coral Project⁩ - - -
- -
-
- -
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
-
- - Lukas - - -
-
-
- -
-
-
-
-
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (5:6) +4: ) { +5: me(clientAuthRevision: $authRevision) { + ^ +6: ...StreamContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/renderReplies.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/renderReplies.spec.tsx.snap index bc69ca2ca..dbdc4fd2e 100644 --- a/src/core/client/stream/test/__snapshots__/renderReplies.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/renderReplies.spec.tsx.snap @@ -4,374 +4,15 @@ exports[`renders comment stream 1`] = `
-
-
-
- - -
-
- -
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
- - Lukas - - -
-
-
- -
-
-
-
-
-
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (5:6) +4: ) { +5: me(clientAuthRevision: $authRevision) { + ^ +6: ...StreamContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/renderStream.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/renderStream.spec.tsx.snap index befacc4ef..dbdc4fd2e 100644 --- a/src/core/client/stream/test/__snapshots__/renderStream.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/renderStream.spec.tsx.snap @@ -4,262 +4,15 @@ exports[`renders comment stream 1`] = `
-
-
-
- - -
-
- -
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
-
- - Lukas - - -
-
-
- -
-
-
-
-
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (5:6) +4: ) { +5: me(clientAuthRevision: $authRevision) { + ^ +6: ...StreamContainer_me +
`; diff --git a/src/core/client/stream/test/__snapshots__/showAllReplies.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/showAllReplies.spec.tsx.snap index d8a24d800..4bfa26a4a 100644 --- a/src/core/client/stream/test/__snapshots__/showAllReplies.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/showAllReplies.spec.tsx.snap @@ -4,284 +4,15 @@ exports[`renders comment stream 1`] = `
-
-
-
- - -
-
- -
-
-
-
-
-
- - Markus - - -
-
-
- -
-
-
-
-
-
-
- - Lukas - - -
-
-
- -
-
-
-
- -
-
-
-
+
+ Unknown argument "clientAuthRevision" on field "me" of type "Query". + +GraphQL request (5:6) +4: ) { +5: me(clientAuthRevision: $authRevision) { + ^ +6: ...StreamContainer_me +
`; diff --git a/src/core/client/ui/components/ValidationMessage/ValidationMessage.css b/src/core/client/ui/components/Message/Message.css similarity index 75% rename from src/core/client/ui/components/ValidationMessage/ValidationMessage.css rename to src/core/client/ui/components/Message/Message.css index b3d6a6290..5811ad377 100644 --- a/src/core/client/ui/components/ValidationMessage/ValidationMessage.css +++ b/src/core/client/ui/components/Message/Message.css @@ -7,8 +7,15 @@ padding: calc(0.5 * var(--spacing-unit)) var(--spacing-unit); box-sizing: border-box; border-radius: var(--round-corners); + border-width: 1px; + border-style: solid; border-left-width: calc(0.5 * var(--spacing-unit)); - border-left-style: solid; +} + +.colorGrey { + background-color: var(--palette-common-white); + border-color: var(--palette-grey-main); + color: var(--palette-grey-main); } .colorError { @@ -21,7 +28,3 @@ display: flex; width: 100%; } - -.icon { - margin-right: var(--spacing-unit); -} diff --git a/src/core/client/ui/components/Message/Message.mdx b/src/core/client/ui/components/Message/Message.mdx new file mode 100644 index 000000000..828d18036 --- /dev/null +++ b/src/core/client/ui/components/Message/Message.mdx @@ -0,0 +1,28 @@ +--- +name: Message +menu: UI Kit +--- + +import { Playground } from 'docz' +import Message from './Message' +import MessageIcon from './MessageIcon' +import HorizontalGutter from '../HorizontalGutter' + +# Message + +## Basic Use + + + This is a message + Contrary to popular belief, Lorem Ipsum is not simply random text. + + + +## Usage with icon + + + alarmEdit: 1 min 23 secs Remaining + + + + diff --git a/src/core/client/ui/components/Message/Message.spec.tsx b/src/core/client/ui/components/Message/Message.spec.tsx new file mode 100644 index 000000000..ac69cea85 --- /dev/null +++ b/src/core/client/ui/components/Message/Message.spec.tsx @@ -0,0 +1,25 @@ +import React from "react"; +import TestRenderer from "react-test-renderer"; + +import { PropTypesOf } from "talk-ui/types"; + +import Message from "./Message"; +import MessageIcon from "./MessageIcon"; + +it("renders correctly", () => { + const props: PropTypesOf = { + className: "custom", + children: "Hello World", + }; + const renderer = TestRenderer.create(); + expect(renderer.toJSON()).toMatchSnapshot(); +}); + +it("renders icon", () => { + const renderer = TestRenderer.create( + + alertAlert Message + + ); + expect(renderer.toJSON()).toMatchSnapshot(); +}); diff --git a/src/core/client/ui/components/Message/Message.tsx b/src/core/client/ui/components/Message/Message.tsx new file mode 100644 index 000000000..7547d8442 --- /dev/null +++ b/src/core/client/ui/components/Message/Message.tsx @@ -0,0 +1,55 @@ +import cn from "classnames"; +import React, { ReactNode, StatelessComponent } from "react"; +import { withStyles } from "talk-ui/hocs"; +import * as styles from "./Message.css"; + +export interface MessageProps { + /** + * The content of the component. + */ + children: ReactNode; + /** + * Convenient prop to override the root styling. + */ + className?: string; + /** + * Override or extend the styles applied to the component. + */ + classes: typeof styles; + /* + * If set renders a full width message + */ + fullWidth?: boolean; + /* + * Name of color, "grey" stays by default - common gray one + */ + color?: "error" | "grey"; +} + +const Message: StatelessComponent = props => { + const { className, classes, fullWidth, children, color, ...rest } = props; + + const rootClassName = cn( + classes.root, + { + [classes.colorGrey]: color === "grey", + [classes.colorError]: color === "error", + [classes.fullWidth]: fullWidth, + }, + className + ); + + return ( +
+ {children} +
+ ); +}; + +Message.defaultProps = { + color: "grey", + fullWidth: false, +}; + +const enhanced = withStyles(styles)(Message); +export default enhanced; diff --git a/src/core/client/ui/components/Message/MessageIcon.css b/src/core/client/ui/components/Message/MessageIcon.css new file mode 100644 index 000000000..df730b2de --- /dev/null +++ b/src/core/client/ui/components/Message/MessageIcon.css @@ -0,0 +1,5 @@ +.root { + &:first-child { + margin-right: calc(0.5 * var(--spacing-unit)); + } +} diff --git a/src/core/client/ui/components/Message/MessageIcon.tsx b/src/core/client/ui/components/Message/MessageIcon.tsx new file mode 100644 index 000000000..cd4d0ad13 --- /dev/null +++ b/src/core/client/ui/components/Message/MessageIcon.tsx @@ -0,0 +1,36 @@ +import cn from "classnames"; +import React, { HTMLAttributes, Ref, StatelessComponent } from "react"; + +import Icon, { IconProps } from "talk-ui/components/Icon"; +import { withForwardRef, withStyles } from "talk-ui/hocs"; + +import * as styles from "./MessageIcon.css"; + +interface InnerProps extends HTMLAttributes { + /** + * This prop can be used to add custom classnames. + * It is handled by the `withStyles `HOC. + */ + classes: typeof styles & IconProps["classes"]; + + size?: IconProps["size"]; + + /** The name of the icon to render */ + children: string; + + /** Internal: Forwarded Ref */ + forwardRef?: Ref; +} + +export const MessageIcon: StatelessComponent = props => { + const { classes, className, forwardRef, ...rest } = props; + const rootClassName = cn(classes.root, className); + return ; +}; + +MessageIcon.defaultProps = { + size: "sm", +}; + +const enhanced = withForwardRef(withStyles(styles)(MessageIcon)); +export default enhanced; diff --git a/src/core/client/ui/components/Message/__snapshots__/Message.spec.tsx.snap b/src/core/client/ui/components/Message/__snapshots__/Message.spec.tsx.snap new file mode 100644 index 000000000..38381f0c6 --- /dev/null +++ b/src/core/client/ui/components/Message/__snapshots__/Message.spec.tsx.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders correctly 1`] = ` +
+ Hello World +
+`; + +exports[`renders icon 1`] = ` +
+ + Alert Message +
+`; diff --git a/src/core/client/ui/components/Message/index.ts b/src/core/client/ui/components/Message/index.ts new file mode 100644 index 000000000..a6d22dd86 --- /dev/null +++ b/src/core/client/ui/components/Message/index.ts @@ -0,0 +1 @@ +export { default } from "./Message"; diff --git a/src/core/client/ui/components/ValidationMessage/ValidationMessage.mdx b/src/core/client/ui/components/ValidationMessage/ValidationMessage.mdx index c8e7b11ad..28bbec5a6 100644 --- a/src/core/client/ui/components/ValidationMessage/ValidationMessage.mdx +++ b/src/core/client/ui/components/ValidationMessage/ValidationMessage.mdx @@ -4,7 +4,7 @@ menu: UI Kit --- import { Playground } from 'docz' -import ValidationMessage from './ValidationMessage.tsx' +import ValidationMessage from './ValidationMessage' import HorizontalGutter from '../HorizontalGutter' # ValidationMessage diff --git a/src/core/client/ui/components/ValidationMessage/ValidationMessage.tsx b/src/core/client/ui/components/ValidationMessage/ValidationMessage.tsx index 0cc781560..8d1343f8b 100644 --- a/src/core/client/ui/components/ValidationMessage/ValidationMessage.tsx +++ b/src/core/client/ui/components/ValidationMessage/ValidationMessage.tsx @@ -1,10 +1,6 @@ -import cn from "classnames"; import React, { ReactNode, StatelessComponent } from "react"; - -import { withStyles } from "talk-ui/hocs"; - -import Icon from "../Icon"; -import * as styles from "./ValidationMessage.css"; +import Message from "../Message"; +import MessageIcon from "../Message/MessageIcon"; export interface ValidationMessageProps { /** @@ -16,34 +12,24 @@ export interface ValidationMessageProps { */ className?: string; /** - * Override or extend the styles applied to the component. + * If set renders a full width message */ - classes: typeof styles; - /* - * If set renders a full width message - */ fullWidth?: boolean; } const ValidationMessage: StatelessComponent = props => { - const { className, classes, fullWidth, children, ...rest } = props; - - const rootClassName = cn( - classes.root, - classes.colorError, - { - [classes.fullWidth]: fullWidth, - }, - className - ); + const { className, fullWidth, children, ...rest } = props; return ( -
- - warning - + + warning {children} -
+
); }; @@ -51,5 +37,4 @@ ValidationMessage.defaultProps = { fullWidth: false, }; -const enhanced = withStyles(styles)(ValidationMessage); -export default enhanced; +export default ValidationMessage; diff --git a/src/core/client/ui/components/ValidationMessage/__snapshots__/ValidationMessage.spec.tsx.snap b/src/core/client/ui/components/ValidationMessage/__snapshots__/ValidationMessage.spec.tsx.snap index 7f03e37e0..c0e1861bb 100644 --- a/src/core/client/ui/components/ValidationMessage/__snapshots__/ValidationMessage.spec.tsx.snap +++ b/src/core/client/ui/components/ValidationMessage/__snapshots__/ValidationMessage.spec.tsx.snap @@ -2,11 +2,11 @@ exports[`renders correctly 1`] = `
diff --git a/src/core/client/ui/components/index.ts b/src/core/client/ui/components/index.ts index 28a3f5c36..78261d408 100644 --- a/src/core/client/ui/components/index.ts +++ b/src/core/client/ui/components/index.ts @@ -20,4 +20,5 @@ export { default as Spinner } from "./Spinner"; export { default as HorizontalGutter } from "./HorizontalGutter"; export { default as Icon } from "./Icon"; export { default as AriaInfo } from "./AriaInfo"; +export { default as Message } from "./Message"; export { Tab, TabBar, TabContent, TabPane } from "./Tabs";