diff --git a/src/core/client/stream/components/Comment/Comment.css b/src/core/client/stream/components/Comment/Comment.css index c4bf8c532..5c0f67095 100644 --- a/src/core/client/stream/components/Comment/Comment.css +++ b/src/core/client/stream/components/Comment/Comment.css @@ -1,3 +1,6 @@ +.root { + width: 100%; +} .footer { margin-top: var(--spacing-unit); } diff --git a/src/core/client/stream/components/Comment/Comment.tsx b/src/core/client/stream/components/Comment/Comment.tsx index 932cd7155..b47c8ac02 100644 --- a/src/core/client/stream/components/Comment/Comment.tsx +++ b/src/core/client/stream/components/Comment/Comment.tsx @@ -20,7 +20,7 @@ export interface CommentProps { const Comment: StatelessComponent = props => { return ( -
+
{props.author && props.author.username && {props.author.username}} diff --git a/src/core/client/stream/components/Comment/__snapshots__/Comment.spec.tsx.snap b/src/core/client/stream/components/Comment/__snapshots__/Comment.spec.tsx.snap index c86fc9284..d9a3e46f0 100644 --- a/src/core/client/stream/components/Comment/__snapshots__/Comment.spec.tsx.snap +++ b/src/core/client/stream/components/Comment/__snapshots__/Comment.spec.tsx.snap @@ -2,6 +2,7 @@ exports[`renders username and body 1`] = `
diff --git a/src/core/client/stream/components/Comment/__snapshots__/TopBar.spec.tsx.snap b/src/core/client/stream/components/Comment/__snapshots__/TopBar.spec.tsx.snap index 6c5348d0b..2e6694137 100644 --- a/src/core/client/stream/components/Comment/__snapshots__/TopBar.spec.tsx.snap +++ b/src/core/client/stream/components/Comment/__snapshots__/TopBar.spec.tsx.snap @@ -1,9 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders correctly on big screens 1`] = ` -
+
Hello World @@ -13,9 +15,11 @@ exports[`renders correctly on big screens 1`] = ` `; exports[`renders correctly on small screens 1`] = ` -
+
Hello World 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 8f0c81faa..d3310dc45 100644 --- a/src/core/client/stream/test/__snapshots__/loadMore.spec.tsx.snap +++ b/src/core/client/stream/test/__snapshots__/loadMore.spec.tsx.snap @@ -1,17 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`loads more comments 1`] = ` -
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
Show all Comments -
+
-
+
+
-
+
-
+
-
+
-
+
-
+
+
+
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
* { + margin: 0 calc(2 * var(--spacing-unit)) 0 0 !important; + } + &.directionRowReverse { + & > * { + margin: 0 0 0 calc(2 * var(--spacing-unit)) !important; + } + } + &.directionColumn { + & > * { + margin: 0 0 calc(2 * var(--spacing-unit)) 0 !important; + } + } + &.directionColumnReverese { + & > * { + margin: calc(2 * var(--spacing-unit)) 0 0 0 !important; + } + } + & > *:last-child { + margin: 0 !important; + } +} + .itemGutter { & > * { margin: 0 var(--spacing-unit) 0 0 !important; @@ -93,6 +122,23 @@ margin-left: calc(0.5 * var(--spacing-unit)) !important; } } + + &:not(.directionColumn).doubleItemGutter { + &:not(:empty) { + margin-top: calc(-2 * var(--spacing-unit)) !important; + } + & > * { + margin-top: calc(2 * var(--spacing-unit)) !important; + } + } + &.directionColumn.doubleItemGutter { + &:not(:empty) { + margin-left: calc(-2 * var(--spacing-unit)) !important; + } + &.doubleItemGutter > * { + margin-left: calc(2 * var(--spacing-unit)) !important; + } + } } .justifyFlexStart { diff --git a/src/core/client/ui/components/Flex/Flex.mdx b/src/core/client/ui/components/Flex/Flex.mdx index 84eeb8240..7ca59bb54 100644 --- a/src/core/client/ui/components/Flex/Flex.mdx +++ b/src/core/client/ui/components/Flex/Flex.mdx @@ -33,3 +33,29 @@ import Button from '../Button' + +## Item Gutter + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/core/client/ui/components/Flex/Flex.tsx b/src/core/client/ui/components/Flex/Flex.tsx index c29bd814c..bf66f9084 100644 --- a/src/core/client/ui/components/Flex/Flex.tsx +++ b/src/core/client/ui/components/Flex/Flex.tsx @@ -25,7 +25,7 @@ interface InnerProps { | "space-evenly"; alignItems?: "flex-start" | "flex-end" | "center" | "baseline" | "stretch"; direction?: "row" | "column" | "row-reverse" | "column-reverse"; - itemGutter?: boolean | "half"; + itemGutter?: boolean | "half" | "double"; className?: string; wrap?: boolean | "reverse"; @@ -43,6 +43,7 @@ const Flex: StatelessComponent = props => { itemGutter, wrap, forwardRef, + children, ...rest } = props; @@ -55,6 +56,7 @@ const Flex: StatelessComponent = props => { const classObject: Record = { [classes.itemGutter]: itemGutter === true, [classes.halfItemGutter]: itemGutter === "half", + [classes.doubleItemGutter]: itemGutter === "double", [classes.wrap]: wrap === true, [classes.wrapReverse]: wrap === "reverse", }; @@ -75,12 +77,13 @@ const Flex: StatelessComponent = props => { classObject[(classes as any)[`direction${pascalCase(direction)}`]] = true; } - const classNames: string = cn(classes.root, className, classObject); + const rootClassNames: string = cn(classes.root, className); + const flexClassNames: string = cn(classes.flex, classObject); // The first div is required to support nested `Flex` components with itemGutters. return ( -
-
+
+
{children}
); }; diff --git a/src/core/client/ui/components/Flex/__snapshots__/Flex.spec.tsx.snap b/src/core/client/ui/components/Flex/__snapshots__/Flex.spec.tsx.snap index b1f72d74b..d96f60ebd 100644 --- a/src/core/client/ui/components/Flex/__snapshots__/Flex.spec.tsx.snap +++ b/src/core/client/ui/components/Flex/__snapshots__/Flex.spec.tsx.snap @@ -1,9 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders correctly 1`] = ` -
+
Hello World @@ -13,9 +15,11 @@ exports[`renders correctly 1`] = ` `; exports[`renders with halfe item gutter 1`] = ` -
+
Hello World @@ -25,9 +29,11 @@ exports[`renders with halfe item gutter 1`] = ` `; exports[`renders with item gutter 1`] = ` -
+
Hello World @@ -37,9 +43,11 @@ exports[`renders with item gutter 1`] = ` `; exports[`renders with wrap 1`] = ` -
+
Hello World @@ -49,9 +57,11 @@ exports[`renders with wrap 1`] = ` `; exports[`renders with wrap reverse 1`] = ` -
+
Hello World