Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 53007c2

Browse files
committed
docs: document all components
1 parent ce625a5 commit 53007c2

36 files changed

+492
-153
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ module.exports = {
1111
'react/prop-types': 'off',
1212
'react/require-default-props': 'off',
1313

14-
'no-return-assign': 'off',
1514
'import/prefer-default-export': 'off',
15+
16+
'no-return-assign': 'off',
1617
},
1718
}

docs/Grid.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
Simple:
1+
## Responsive breakpoints
2+
3+
Using `xs`, `sm`, `md`, `lg` and `xl` you can set size using responsive breakpoints.
24

35
```js
46
<Row>
5-
<Col xs style={{ background: 'red' }}>
6-
1
7-
</Col>
8-
<Col xs style={{ background: 'blue' }}>
9-
2
10-
</Col>
7+
<Col xs>1</Col>
8+
<Col xs>2</Col>
119
</Row>
1210
```

docs/Introduction.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
Hello all
1+
Smooth UI is an open source components library built with [React](https://reactjs.org/) and [Styled Components](https://www.styled-components.com).
22

3+
It is focused on developer experience and accessibility. With Smooth UI, it is easy to design beautiful websites and applications.
4+
5+
It is currently in development and a lot of breaking changes could happen. Be careful before using it.

src/Box.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Box is a simple component to create flexboxes based layout that are not part of [a grid](#grid).
2+
3+
### Example
4+
5+
```js
6+
<Box
7+
padding="10px"
8+
justifyContent="space-between"
9+
style={{ background: '#bd4932' }}
10+
>
11+
<Box padding="20px" style={{ background: 'white' }}>
12+
Left
13+
</Box>
14+
<Box padding="20px" style={{ background: 'white' }}>
15+
Middle
16+
</Box>
17+
<Box padding="20px" style={{ background: 'white' }}>
18+
Right
19+
</Box>
20+
</Box>
21+
```

src/Button.js

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,47 @@ const ButtonComponent = ({ className, size, ...props }) => (
2020
)
2121

2222
const Button = styled(handleRef(ButtonComponent))`
23-
&.sui-button {
24-
display: inline-block;
25-
padding: ${props => props.theme.textControlPadding.sm};
26-
z-index: ${props => props.theme.zIndexes.control};
27-
border-radius: ${props => props.theme.borderRadius.md};
28-
font-size: 1rem;
29-
line-height: 1.5;
30-
background-color: ${props => props.theme.colors.primary};
31-
color: ${props => props.theme.colors.white};
32-
border: 0;
33-
cursor: pointer;
34-
transition: background-color 300ms;
23+
display: inline-block;
24+
padding: ${props => props.theme.textControlPadding.sm};
25+
z-index: ${props => props.theme.zIndexes.control};
26+
border-radius: ${props => props.theme.borderRadius.md};
27+
font-size: 1rem;
28+
line-height: 1.5;
29+
background-color: ${props => props.theme.colors.primary};
30+
color: ${props => props.theme.colors.white};
31+
border: 0;
32+
cursor: pointer;
33+
transition: background-color 300ms;
3534
36-
&:focus {
37-
${props => props.theme.mixins.controlFocus};
38-
}
35+
&:focus {
36+
${props => props.theme.mixins.controlFocus};
37+
}
3938
40-
&:hover,
41-
&:active {
42-
background-color: ${props => darken(0.05, props.theme.colors.primary)};
43-
}
39+
&:not(:disabled):hover,
40+
&:not(:disabled):active {
41+
background-color: ${props => darken(0.05, props.theme.colors.primary)};
42+
}
4443
45-
&.sui-button-lg {
46-
padding: ${props => props.theme.textControlPadding.lg};
47-
font-size: ${props => props.theme.controlFontSize.lg};
48-
border-radius: ${props => props.theme.borderRadius.lg};
49-
}
44+
&.sui-button-lg {
45+
padding: ${props => props.theme.textControlPadding.lg};
46+
font-size: ${props => props.theme.controlFontSize.lg};
47+
border-radius: ${props => props.theme.borderRadius.lg};
48+
}
49+
50+
&.sui-button-sm {
51+
padding: ${props => props.theme.textControlPadding.sm};
52+
font-size: ${props => props.theme.controlFontSize.sm};
53+
border-radius: ${props => props.theme.borderRadius.sm};
54+
}
5055
51-
&.sui-button-sm {
52-
padding: ${props => props.theme.textControlPadding.sm};
53-
font-size: ${props => props.theme.controlFontSize.sm};
54-
border-radius: ${props => props.theme.borderRadius.sm};
55-
}
56+
&:disabled {
57+
opacity: 0.8;
5658
}
5759
`
5860

5961
Button.propTypes = {
6062
size: PropTypes.oneOf(['sm', 'lg']),
63+
disabled: PropTypes.bool,
6164
theme: PropTypes.object,
6265
}
6366

src/Button.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
Simple:
1+
### Sizes
2+
3+
Set sizes using `size` prop like `"sm"` or `"lg"`.
24

35
```js
46
<div>
5-
<Button>Hello</Button>
6-
<Button size="sm">Small</Button>
7-
<Button size="lg">Large</Button>
7+
<div style={{ margin: '5px' }}>
8+
<Button size="sm">Small</Button>
9+
</div>
10+
<div style={{ margin: '5px' }}>
11+
<Button>Medium</Button>
12+
</div>
13+
<div style={{ margin: '5px' }}>
14+
<Button size="lg">Large</Button>
15+
</div>
816
</div>
917
```
18+
19+
### Disabled
20+
21+
Disable using `disabled` prop.
22+
23+
```js
24+
<Button disabled>Disabled</Button>
25+
```

src/CheckLabel.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/CheckLabel.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Checkbox.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const CheckboxComponent = ({ className, size, ...props }) => (
1010
className={classNames(
1111
'sui-checkbox',
1212
{
13+
'sui-checkbox-disabled': props.disabled,
1314
[`sui-checkbox-${size}`]: size,
1415
},
1516
className,

src/Checkbox.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
1-
Different sizes:
1+
### Sizes
2+
3+
Set sizes using `size` prop like `"sm"` or `"lg"`.
24

35
```js
46
<div>
5-
<Checkbox size="sm" />
6-
<Checkbox />
7-
<Checkbox size="lg" />
7+
<FormCheck>
8+
<Checkbox
9+
size="sm"
10+
id="sizeCheckbox1"
11+
name="sizeCheckboxs"
12+
value="option1"
13+
/>
14+
<FormCheckLabel htmlFor="sizeCheckbox1">Small</FormCheckLabel>
15+
</FormCheck>
16+
<FormCheck>
17+
<Checkbox id="sizeCheckbox2" name="sizeCheckboxs" value="option2" />
18+
<FormCheckLabel htmlFor="sizeCheckbox2">Medium</FormCheckLabel>
19+
</FormCheck>
20+
<FormCheck>
21+
<Checkbox
22+
size="lg"
23+
id="sizeCheckbox3"
24+
name="sizeCheckboxs"
25+
value="option3"
26+
/>
27+
<FormCheckLabel htmlFor="sizeCheckbox3">Large</FormCheckLabel>
28+
</FormCheck>
829
</div>
930
```
1031

11-
Disabled:
32+
### Disabled
33+
34+
Disable using `disabled` prop.
1235

1336
```js
14-
<Checkbox disabled />
37+
<FormCheck>
38+
<Checkbox
39+
disabled
40+
id="disabledCheckbox1"
41+
name="disabledCheckboxs"
42+
value="option1"
43+
/>
44+
<FormCheckLabel htmlFor="disabledCheckbox1">Disabled</FormCheckLabel>
45+
</FormCheck>
1546
```

0 commit comments

Comments
 (0)