From 07c5295f884ecbb71bf1b72582540bd3c50d3859 Mon Sep 17 00:00:00 2001 From: Michael Taranto Date: Mon, 1 Jul 2024 15:23:54 +1000 Subject: [PATCH] site: Update layout guide content (#1528) --- .../src/lib/components/Bleed/Bleed.docs.tsx | 192 +++++++++----- .../src/lib/components/Card/Card.docs.tsx | 2 +- .../App/routes/foundations/layout/layout.tsx | 241 +++++++++--------- 3 files changed, 252 insertions(+), 183 deletions(-) diff --git a/packages/braid-design-system/src/lib/components/Bleed/Bleed.docs.tsx b/packages/braid-design-system/src/lib/components/Bleed/Bleed.docs.tsx index 86181bd1da6..a71723bcd8b 100644 --- a/packages/braid-design-system/src/lib/components/Bleed/Bleed.docs.tsx +++ b/packages/braid-design-system/src/lib/components/Bleed/Bleed.docs.tsx @@ -1,14 +1,15 @@ import React from 'react'; import type { ComponentDocs } from 'site/types'; -import { Box, Bleed, Stack, Text, Strong, TextLink, Tiles } from '../'; +import { Box, Bleed, Stack, Text, Strong, TextLink, Tiles, Toggle } from '../'; import { Placeholder } from '../../playroom/components'; import source from '@braid-design-system/source.macro'; +import { vars } from '../../themes/vars.css'; const docs: ComponentDocs = { category: 'Layout', Example: () => source( - + @@ -66,14 +67,23 @@ const docs: ComponentDocs = { ), Example: () => source( - - + + - + + + + + + + , ), }, @@ -87,14 +97,16 @@ const docs: ComponentDocs = { ), Example: () => source( - - - - + + + + + + + + + + , ), }, @@ -110,41 +122,71 @@ const docs: ComponentDocs = { Example: () => source( - - - - + + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + + + + + + + , ), @@ -157,17 +199,49 @@ const docs: ComponentDocs = { using the space prop. ), - Example: () => + Example: ({ setDefaultState, getState, toggleState }) => source( - - - - - , + <> + {setDefaultState('bleed', true)} + + toggleState('bleed')} + /> + + + + + + + + + + + + + + + + + + + + , ), }, ], diff --git a/packages/braid-design-system/src/lib/components/Card/Card.docs.tsx b/packages/braid-design-system/src/lib/components/Card/Card.docs.tsx index 6e1b33b64b5..937b35a0376 100644 --- a/packages/braid-design-system/src/lib/components/Card/Card.docs.tsx +++ b/packages/braid-design-system/src/lib/components/Card/Card.docs.tsx @@ -6,7 +6,7 @@ import source from '@braid-design-system/source.macro'; import { validCardComponents } from './Card'; const docs: ComponentDocs = { - category: 'Layout', + category: 'Content', Example: () => source( diff --git a/site/src/App/routes/foundations/layout/layout.tsx b/site/src/App/routes/foundations/layout/layout.tsx index 953af3fdf8f..88df00e38b4 100644 --- a/site/src/App/routes/foundations/layout/layout.tsx +++ b/site/src/App/routes/foundations/layout/layout.tsx @@ -102,10 +102,10 @@ const page: DocsPage = { - Box + Spacing - Card + Box Stack @@ -142,28 +142,58 @@ const page: DocsPage = { this scale rather than generating custom spacing rules. - {spaceScale.map((space) => ( - - - - {space} - - - - - - - - - - - ))} + {spaceScale + .filter((s) => s !== 'gutter') + .map((space) => ( + + + + {space} + + + + + + + + + + + ))} + + In addition to the scale, Braid has a semantic value{' '} + gutter — used to maintain consistent insets across + components, e.g. Card,{' '} + Alert,{' '} + Button, etc. This value + should only be used for aligning to this concept. + + + + + + gutter + + + + + + + + + + + Box @@ -238,23 +268,6 @@ const page: DocsPage = { - Card - - Rather than nesting content in arbitrary{' '} - Box elements, you may prefer to use - standard Card elements - instead. - - - {source( - - Lorem ipsum dolor sit amet. - , - )} - - - - Stack The most common white space on screen is between elements stacked @@ -270,13 +283,11 @@ const page: DocsPage = { {source( - - - Heading - {lipsum1} - {lipsum2} - - , + + Heading + {lipsum1} + {lipsum2} + , )} @@ -285,13 +296,11 @@ const page: DocsPage = { {source( - - - Heading - {lipsum1} - {lipsum2} - - , + + Heading + {lipsum1} + {lipsum2} + , )} @@ -302,13 +311,11 @@ const page: DocsPage = { {source( - - - Heading - {lipsum1} - {lipsum2} - - , + + Heading + {lipsum1} + {lipsum2} + , )} @@ -318,26 +325,24 @@ const page: DocsPage = { {source( - - - Heading - {lipsum1} - - {lipsum2} - - , + + Heading + {lipsum1} + + {lipsum2} + , )} Multiple Stack components can be nested to create more complex white space rules. For example, if you wanted to create multiple grouped blocks of text like you might see - on a job summary card: + in a Card: {source( - + Heading Line 1 @@ -355,23 +360,21 @@ const page: DocsPage = { Stack also supports - horizontal alignment. For example, if you wanted to centre align all - content within a card: + horizontal alignment. For example, if you wanted to centre align all of + its content: {source( - - - - Badge - - Heading Text - - - Lorem ipsum dolor sit amet. - - - , + + + Badge + + Heading Text + + + Lorem ipsum dolor sit amet. + + , )} @@ -382,15 +385,13 @@ const page: DocsPage = { {source( - - - Item 1 - - Item 2 - - Item 3 - - , + + Item 1 + + Item 2 + + Item 3 + , )} @@ -405,19 +406,17 @@ const page: DocsPage = { {source( - - - Lorem ipsum - Dolor - Sit amet - Consectetur - Adipiscing elit - Suspendisse dignissim - Dapibus elit - Vel egestas felis - Pharetra non - - , + + Lorem ipsum + Dolor + Sit amet + Consectetur + Adipiscing elit + Suspendisse dignissim + Dapibus elit + Vel egestas felis + Pharetra non + , )} @@ -429,19 +428,17 @@ const page: DocsPage = { {source( - - - Lorem ipsum - Dolor - Sit amet - - , + + Lorem ipsum + Dolor + Sit amet + , )} - If you’d like the columns to stack vertically on smaller screens, you - can provide the{' '} + If you’d like the items to stack vertically on smaller screens, you can + provide the{' '} collapseBelow {' '} @@ -453,12 +450,10 @@ const page: DocsPage = { {source( - - - - - - , + + + + , )} @@ -913,7 +908,7 @@ const page: DocsPage = { {source( - + Heading Text content @@ -935,7 +930,7 @@ const page: DocsPage = { {source( - +