Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(comp/docs): change Inline component default align + use it in DoAndDont #1521

Merged
merged 3 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/heavy-pens-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"docs": patch
"@marigold/components": patch
---

feat(comp/docs): change Inline component default align + use it in DoAndDont
13 changes: 7 additions & 6 deletions docs/content/components/inline.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ Layout component to inline elements with space. This component uses the spaces f

## Properties

| Property | Type | Default |
| :------- | :----------------------------- | :------ |
| `as` | `div⎮span` | `div` |
| `space` | `ResponsiveStyleValue<string>` | `none` |
| Property | Type | Default |
| :------- | :----------------------------- | :------- |
| `as` | `div⎮span` | `div` |
| `space` | `ResponsiveStyleValue<string>` | `none` |
| `align` | `left, right, center` | `center` |

## Import

Expand Down Expand Up @@ -69,14 +70,14 @@ import { Inline } from '@marigold/components';
### Alignment

```tsx
<Inline space="medium">
<Inline space="medium" align="top">
<Heading>Top</Heading>
<Text>Lorem ipsum dolor sit amet.</Text>
</Inline>
```

```tsx
<Inline space="medium" align="center">
<Inline space="medium">
<Heading>Center</Heading>
<Text>Lorem ipsum dolor sit amet.</Text>
</Inline>
Expand Down
26 changes: 18 additions & 8 deletions docs/src/components/DoAndDont.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import * as React from 'react';

import { Box, Card, Divider, Heading, Text } from '@marigold/components';
import {
Box,
Card,
Divider,
Heading,
Inline,
Text,
} from '@marigold/components';
import { Banned, Check } from '@marigold/icons';
import { ComponentProps } from '@marigold/types';

Expand Down Expand Up @@ -33,17 +40,20 @@ export const DoAndDont: React.FC<DoAndDontProps> = ({
css={{ color: dont ? 'red' : 'green' }}
>
{dont ? (
<Box as="span" mr="xsmall">
<Inline as="span" space="xsmall" align="center">
<Banned size={20} />
</Box>
<Heading as="h4" variant="h4">
Don't
</Heading>
</Inline>
) : (
<Box as="span" mr="xsmall">
<Inline as="span" space="xsmall" align="center">
<Check size={20} />
</Box>
<Heading as="h4" variant="h4">
Do
</Heading>
</Inline>
)}
<Heading as="h4" variant="h4">
{dont ? "Don't" : `Do`}
</Heading>
</Box>
<Text variant="muted">{children}</Text>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/Inline/Inline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ALIGNMENT = {
export const Inline: React.FC<InlineProps> = ({
as = 'div',
space = 'none',
align = 'top',
align = 'center',
children,
...props
}) => (
Expand Down