From 3bf3a8e66c989185171b6d53e1af4573da817303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20K=C3=B6hler?= <77496890+aromko@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:07:46 +0100 Subject: [PATCH] docs[DST-615]: Revise `
`documentation (#4312) --- .changeset/three-apes-decide.md | 8 +++ .../components/layout/center/center.demo.tsx | 10 +++ .../components/layout/center/center.mdx | 63 +++++++++++-------- .../layout/center/space-center.demo.tsx | 9 --- .../layout/center/text-center.demo.tsx | 22 ------- .../layout/center/width-center.demo.tsx | 7 --- .../components/src/Center/Center.stories.tsx | 30 ++++----- 7 files changed, 66 insertions(+), 83 deletions(-) create mode 100644 .changeset/three-apes-decide.md create mode 100644 docs/content/components/layout/center/center.demo.tsx delete mode 100644 docs/content/components/layout/center/space-center.demo.tsx delete mode 100644 docs/content/components/layout/center/text-center.demo.tsx delete mode 100644 docs/content/components/layout/center/width-center.demo.tsx diff --git a/.changeset/three-apes-decide.md b/.changeset/three-apes-decide.md new file mode 100644 index 0000000000..890a4c11eb --- /dev/null +++ b/.changeset/three-apes-decide.md @@ -0,0 +1,8 @@ +--- +"@marigold/docs": patch +"@marigold/components": patch +--- + +docs([DST-615]): Revise `
` documentation + +Revised the `
` page according to our new structure of component documentation. diff --git a/docs/content/components/layout/center/center.demo.tsx b/docs/content/components/layout/center/center.demo.tsx new file mode 100644 index 0000000000..c11a736257 --- /dev/null +++ b/docs/content/components/layout/center/center.demo.tsx @@ -0,0 +1,10 @@ +import { Center } from '@marigold/components'; +import { Rectangle } from '@/ui/Rectangle'; + +export default () => ( +
+ + + +
+); diff --git a/docs/content/components/layout/center/center.mdx b/docs/content/components/layout/center/center.mdx index 8a29db3906..13a4226337 100644 --- a/docs/content/components/layout/center/center.mdx +++ b/docs/content/components/layout/center/center.mdx @@ -1,39 +1,50 @@ --- title: Center caption: Component to center its children horizontally. +badge: updated --- -The `
` is a layout component that centers its children horizontally. -You can use it to center a single child or a list of children. The `
` component has also the property maxWidth. +The `
` is a layout component that centers its children horizontally within a container. -The `
` component can also be a child from the [``](/components/stack/) or [``](/components/inline/) component. +## Usage -## Import +You can use it to center a single child or a list of children. The `maxWidth` prop sets the maximum width of the container +and the `space` prop adds spacing between the children elements. -```tsx -import { Center } from '@marigold/components'; -``` +The `
` component can also be used with components like [``](/components/content/text), [``](/components/layout/stack/) or [``](/components/layout/inline/) component. -## Props - - - -## Examples - -### Center element with maximum width - -To center an element you must give the element a `maxWidth` prop. + - - -### Center more than one element with space - -To add spaces between each child you can use the prop `space`. - - +## Props -### Center inside Text Block + -If you want to center something like a ` -
- - Evading the dreaded Imperial Starfleet, a group of freedom fighters led by - Luke Skywalker has established a new secret base on the remote ice world - of Hoth. The evil lord Darth Vader, obsessed with finding young Skywalker, - has dispatched thousands of remote probes into the far reaches of - space.... - -
-); diff --git a/docs/content/components/layout/center/width-center.demo.tsx b/docs/content/components/layout/center/width-center.demo.tsx deleted file mode 100644 index 7c33fc11c3..0000000000 --- a/docs/content/components/layout/center/width-center.demo.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { Center } from '@marigold/components'; - -export default () => ( -
-
-
-); diff --git a/packages/components/src/Center/Center.stories.tsx b/packages/components/src/Center/Center.stories.tsx index 7307e091d2..4260d964a2 100644 --- a/packages/components/src/Center/Center.stories.tsx +++ b/packages/components/src/Center/Center.stories.tsx @@ -18,7 +18,7 @@ const meta = { 'the maximum width of the center element. Should be a string value (e.g. 500px)', table: { defaultValue: { - summary: 'not set', + summary: '100%', }, }, }, @@ -42,42 +42,34 @@ type Story = StoryObj; export const Basic: Story = { render: args => ( -
-
+
+
), }; export const Children: Story = { render: args => ( -
-
-
-
+
+
+
+
), }; -export const Icon: Story = { +export const Nested: Story = { render: args => (
- +
+ +
), }; -export const SpaceCenter: Story = { - render: args => ( -
-
-
-
-
- ), -}; - export const Complex: Story = { render: args => (