Skip to content

Commit

Permalink
docs: update space
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Nov 19, 2023
1 parent 93aa3e6 commit fbd6fa1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 49 deletions.
49 changes: 0 additions & 49 deletions packages/react-docs/pages/components/space.page.mdx

This file was deleted.

18 changes: 18 additions & 0 deletions packages/react-docs/pages/components/space/horizontal-spacing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Button, Icon, Space } from '@tonic-ui/react';
import React from 'react';

const App = () => (
<>
<Button variant="ghost" width="8x" height="8x" borderRadius="circle">
<Icon icon="add" />
</Button>
<Space width="2x" />
<Button variant="ghost" borderRadius="2rem">
<Icon icon="settings" />
<Space width="2x" />
Settings
</Button>
</>
);

export default App;
29 changes: 29 additions & 0 deletions packages/react-docs/pages/components/space/index.page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Space

Space is [Box](box) with `display="inline-flex"`. You can specify either `width` or `height` to add space between two elements.

## Import

```js
import { Space } from '@tonic-ui/react';
```

## Usage

### Horizontal spacing

{render('./horizontal-spacing')}

### Vertical spacing

{render('./vertical-spacing')}

## Props

### Space

| Name | Type | Default | Description |
| :--- | :--- | :------ | :---------- |
| children | ReactNode | | |
| height | number \| string | | |
| width | number \| string | | |
14 changes: 14 additions & 0 deletions packages/react-docs/pages/components/space/vertical-spacing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Flex, Input, Space, Text, TextLabel } from '@tonic-ui/react';
import React from 'react';

const App = () => (
<Flex flexDirection="column">
<TextLabel>Text label</TextLabel>
<Space height="2x" />
<Input placeholder="Text input" />
<Space height="1x" />
<Text size="xs">Help text for the text input</Text>
</Flex>
);

export default App;

0 comments on commit fbd6fa1

Please sign in to comment.