Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

[FRNT-371] Implement Separator atom #92

Merged
merged 1 commit into from
Apr 23, 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
1 change: 1 addition & 0 deletions src/ui/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export { Input } from './input';
export { Label } from './label';
export { List } from './list';
export { Notification } from './notification';
export { Separator } from './separator';
export { Surface } from './surface';
export { Text } from './text';
export { TextArea } from './text-area';
Expand Down
21 changes: 21 additions & 0 deletions src/ui/atoms/separator/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react';
import styled, { StyledComponent } from 'styled-components';
import { Variant } from 'lib/types';

const SeparatorBase: React.FC<{ className: string } & Variant> = ({ className, variant }) => (
<div className={className} data-variant={variant}>
<div data-line></div>
</div>
);

export const Separator = styled(SeparatorBase)`
--local-padding: 3px;

width: 100%;
padding: calc(var(--local-padding) - (var(--woly-border-width) / 2)) 0;

[data-line] {
height: var(--woly-border-width);
background: var(--woly-canvas-disabled);
}
` as StyledComponent<'div', Record<string, unknown>, Variant>;
43 changes: 43 additions & 0 deletions src/ui/atoms/separator/usage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: separator
category: atoms
package: 'woly'
---

import { Playground, block } from 'box-styles'
import { Heading, Input, Separator } from 'ui'

`Sepatator` is a line that divides blocks or content.

### Example

<Playground direction="vertical">
<div style={{ width: '300px' }}>
<div style={{ margin: '18px 0' }}>
<Heading size={2}>User List</Heading>
</div>
<Separator variant="primary" />
<div style={{ margin: '18px 0' }}>
<Input
type="text"
name="name"
placeholder="Search"
onChange={() => console.info('On input change')}
variant="primary"
style={{ margin: '10px 0' }}
/>
</div>
</div>
</Playground>

### Kinds

| Name | Description |
| ----------- | -------------- |
| `Separator` | Base separator |

### Props

| Name | Type | Default | Description |
| --------- | -------- | ----------- | ----------------------------------------- |
| `variant` | `string` | `'default'` | Variant prop to style Separator component |