From 918b6c40c23e7880c74d557c1ace14a198e5d982 Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Thu, 18 Jul 2024 15:10:51 +0200 Subject: [PATCH] docs: refa `DonAndDonts` to work without an image (#4023) * docs: refa `DonAndDonts` to work without an image * Create great-rabbits-join.md * whoops * fix --- .changeset/great-rabbits-join.md | 5 ++ docs/content/__internal__/index.mdx | 64 ++++++++++++++ docs/ui/AppearanceDemo.tsx | 1 + docs/ui/DosAndDonts.tsx | 127 +++++++++++++++++----------- docs/ui/mdx.tsx | 7 +- 5 files changed, 151 insertions(+), 53 deletions(-) create mode 100644 .changeset/great-rabbits-join.md create mode 100644 docs/content/__internal__/index.mdx create mode 100644 docs/ui/AppearanceDemo.tsx diff --git a/.changeset/great-rabbits-join.md b/.changeset/great-rabbits-join.md new file mode 100644 index 0000000000..647bb5a3bf --- /dev/null +++ b/.changeset/great-rabbits-join.md @@ -0,0 +1,5 @@ +--- +"@marigold/docs": patch +--- + +docs: refa `DonAndDonts` to work without an image diff --git a/docs/content/__internal__/index.mdx b/docs/content/__internal__/index.mdx new file mode 100644 index 0000000000..824ddf7681 --- /dev/null +++ b/docs/content/__internal__/index.mdx @@ -0,0 +1,64 @@ +--- +title: Internal +caption: A page to test stuff +--- + +## Do's and Don'ts + + + + + Don't + + + Use one primary call to action to help people to proceed + + + + + Don't + + + Don’t use many calls to action in one page or container. + + + + + + + +
    +
  • Cheese
  • +
  • Milk
  • +
  • Bread
  • +
+
+
+ + +
    +
  • Cheese
  • +
  • Milk
  • +
  • Bread
  • +
+
+
+
+ +- foo +- bar +- baz diff --git a/docs/ui/AppearanceDemo.tsx b/docs/ui/AppearanceDemo.tsx new file mode 100644 index 0000000000..8b67e11b12 --- /dev/null +++ b/docs/ui/AppearanceDemo.tsx @@ -0,0 +1 @@ +export const AppearanceDemo = () => {}; diff --git a/docs/ui/DosAndDonts.tsx b/docs/ui/DosAndDonts.tsx index 0272da1048..8a2e3c4ba9 100644 --- a/docs/ui/DosAndDonts.tsx +++ b/docs/ui/DosAndDonts.tsx @@ -1,58 +1,83 @@ -import React, { ReactNode } from 'react'; - -import { cn } from '../../packages/system/dist'; - -interface Props { - description: string; - variant: 'do' | 'dont'; - children: ReactNode; -} - -const advice = { - do: 'DO', - dont: "DON'T", -}; - -const checkIcon = ( - ) => ( +
- - + {children} +
); -const warningIcon = ( - ( +
- - + {children} +
+); + +const Figure = ({ children }: PropsWithChildren) => ( +
{children}
+); + +const Description = ({ children }: PropsWithChildren) => ( +
+ {children} +
); -export const DosAndDonts = ({ description, variant, children }: Props) => { - const icon = variant === 'do' ? checkIcon : warningIcon; - - return ( -
- {children} -
( + + + <svg + width="10px" + height="10px" + viewBox="0 0 24 24" + className="size-5 flex-none rounded-full bg-green-600 fill-white p-1" > - <div className="flex items-center gap-2"> - {icon} - <h5 className="m-0 font-bold">{advice[variant]}</h5> - </div> - <p className="m-0">{description}</p> - </div> - </div> - ); -}; + <path d="M8.17368 16.6154L3.19528 11.637L1.5 13.3204L8.17368 19.994L22.5 5.66772L20.8167 3.98437L8.17368 16.6154Z"></path> + </svg> + <h5 className="m-0 font-bold uppercase">Do</h5> + + {children} + +); + +Do.Figure = Figure; +Do.Description = Description; + +// Dont +// --------------- +export const Dont = ({ children }: PropsWithChildren) => ( + + + <svg + width="10px" + height="10px" + viewBox="0 0 24 24" + className="size-5 flex-none rounded-full bg-red-600 fill-white p-1" + > + <path d="M19.8281 5.74868L18.2513 4.17188L12 10.4232L5.74868 4.17188L4.17188 5.74868L10.4232 12L4.17188 18.2513L5.74868 19.8281L12 13.5768L18.2513 19.8281L19.8281 18.2513L13.5768 12L19.8281 5.74868Z"></path> + </svg> + <h5 className="m-0 font-bold uppercase">Don't</h5> + + {children} + +); + +Dont.Figure = Figure; +Dont.Description = Description; diff --git a/docs/ui/mdx.tsx b/docs/ui/mdx.tsx index f755622bc7..4c838a1af2 100644 --- a/docs/ui/mdx.tsx +++ b/docs/ui/mdx.tsx @@ -12,6 +12,7 @@ import { Columns, Headline, Link, + List, Scrollable, SectionMessage, Stack, @@ -24,7 +25,7 @@ import { AppearanceTable } from './AppearanceTable'; import { ColorTokenTable } from './ColorTokens'; import { ComponentDemo } from './ComponentDemo'; import { CopyButton } from './CopyButton'; -import { DosAndDonts } from './DosAndDonts'; +import { Do, Dont } from './DosAndDonts'; import { FullsizeView } from './FullsizeViewDemo'; import { Image } from './Image'; import { PropsTable } from './PropsTable'; @@ -131,7 +132,6 @@ const typography = { const components = { ...typography, Image, - DosAndDonts, Link, // Docs Components AlignmentsX, @@ -141,6 +141,8 @@ const components = { Breakpoints, ColorTokenTable, ComponentDemo, + Do, + Dont, FontSizes, FontStyle, FontWeights, @@ -156,6 +158,7 @@ const components = { Card, Columns, Headline, + List, SectionMessage, Scrollable, Stack,