-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into loading-spinner-button
- Loading branch information
Showing
8 changed files
with
67 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@marigold/docs": patch | ||
"@marigold/components": patch | ||
--- | ||
|
||
docs([DST-615]): Revise `<Center>` documentation | ||
|
||
Revised the `<Center>` page according to our new structure of component documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Center } from '@marigold/components'; | ||
import { Rectangle } from '@/ui/Rectangle'; | ||
|
||
export default () => ( | ||
<Center maxWidth="xxlarge" space={1}> | ||
<Rectangle height="50px" width="300px" /> | ||
<Rectangle height="50px" width="300px" /> | ||
<Rectangle height="50px" width="300px" /> | ||
</Center> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,50 @@ | ||
--- | ||
title: Center | ||
caption: Component to center its children horizontally. | ||
badge: updated | ||
--- | ||
|
||
The `<Center>` is a layout component that centers its children horizontally. | ||
You can use it to center a single child or a list of children. The `<Center>` component has also the property maxWidth. | ||
The `<Center>` is a layout component that centers its children <strong>horizontally</strong> within a container. | ||
|
||
The `<Center>` component can also be a child from the [`<Stack>`](/components/stack/) or [`<Inline>`](/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 `<Center>` component can also be used with components like [`<Text>`](/components/content/text), [`<Stack>`](/components/layout/stack/) or [`<Inline>`](/components/layout/inline/) component. | ||
|
||
## Props | ||
|
||
<PropsTable component={title} /> | ||
|
||
## Examples | ||
|
||
### Center element with maximum width | ||
|
||
To center an element you must give the element a `maxWidth` prop. | ||
<ComponentDemo file="./center.demo.tsx" /> | ||
|
||
<ComponentDemo file="./width-center.demo.tsx" /> | ||
|
||
### Center more than one element with space | ||
|
||
To add spaces between each child you can use the prop `space`. | ||
|
||
<ComponentDemo file="./space-center.demo.tsx" /> | ||
## Props | ||
|
||
### Center inside Text Block | ||
<StorybookHintMessage component={title} /> | ||
|
||
If you want to center something like a `<Button>` you must only wrap your component with a `<Center>` component. | ||
<PropsTable component={title} /> | ||
|
||
<ComponentDemo file="./text-center.demo.tsx" /> | ||
## Related | ||
|
||
<TeaserList | ||
items={[ | ||
{ | ||
title: 'Building layouts', | ||
href: '../../foundations/layouts', | ||
caption: 'Learn how to build layouts.', | ||
icon: ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
strokeWidth={1.5} | ||
stroke="currentColor" | ||
className="size-6" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M2.25 7.125C2.25 6.504 2.754 6 3.375 6h6c.621 0 1.125.504 1.125 1.125v3.75c0 .621-.504 1.125-1.125 1.125h-6a1.125 1.125 0 0 1-1.125-1.125v-3.75ZM14.25 8.625c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v8.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 0 1-1.125-1.125v-8.25ZM3.75 16.125c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v2.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 0 1-1.125-1.125v-2.25Z" | ||
/> | ||
</svg> | ||
), | ||
}, | ||
]} | ||
/> |
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
docs/content/components/layout/center/text-center.demo.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters