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

Commit 34dd3fc

Browse files
committed
feat: flatten style & remove classNames
To prepare styled-components v4 & simplify. BREAKING CHANGE: A lot of classes have been removed. Introduced a new default size "md".
1 parent 4609edb commit 34dd3fc

29 files changed

+775
-1007
lines changed

docs/advanced/AddVariant.mdx

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,16 @@ import { theme as defaultTheme, ThemeProvider, Button } from '@smooth-ui/core-sc
1010

1111
Components like `Button` or `Alert` implements some `variants` based on colors.
1212

13-
Variants are defined in theme, so you can add, remove or completely change variants. If you are not confortable with Smooth UI theming, please read [theming guide](/docs-basics-theming) first.
14-
15-
## What is a variant?
16-
17-
A variant is an array of strings defined in theme, for an example `alertVariants` for `Alert` and `btnVariants` for `Button`.
18-
19-
Each string of this array must be a property of your theme, most of the time it represent a color.
13+
You can use any color defined in theme as variant. If you are not confortable with Smooth UI theming, please read [theming guide](/docs-basics-theming) first.
2014

2115
## Example for Button
2216

23-
`Button` variants are defined using `btnVariants` that inherits from `colorVariants`. In our example, we will just add a new `Button` variant.
17+
In documentation, you can see only main variants `Button` but it is possible to use any color defined in theme as variant.
2418

2519
<Playground>
2620
{() => {
27-
const theme = Object.assign({}, defaultTheme, {
28-
violet: '#EE82EE',
29-
btnVariants: [
30-
'primary',
31-
'secondary',
32-
'success',
33-
'danger',
34-
'warning',
35-
'info',
36-
'light',
37-
'dark',
38-
'violet',
39-
]
40-
})
41-
21+
// Define a new theme with "violet" color.
22+
const theme = Object.assign({}, defaultTheme, { violet: '#EE82EE' })
4223
return (
4324
<ThemeProvider theme={theme}>
4425
<Button variant="violet">Violet button 😎</Button>

docs/components/Alert.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Set variants using `variant` prop.
3131
<PropsTable
3232
of={PropDesc({
3333
children: PropDesc.node,
34-
variant: PropDesc.oneOf(themeProp('alertVariants')).defaultTo('primary'),
34+
variant: PropDesc.oneOf(themeProp('colorVariants')).defaultTo('primary'),
3535
...getSystemPropDesc(Alert),
3636
})}
3737
/>

docs/components/Button.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ Set variants using `variant` prop.
2424
<Button variant="info">Info</Button>
2525
<Button variant="light">Light</Button>
2626
<Button variant="dark">Dark</Button>
27-
<Button variant={null}>No variant</Button>
27+
<Button>No variant</Button>
2828
</BlockList>
2929
</Playground>
3030

3131
## Sizes
3232

33-
Set sizes using `size` prop like `"sm"` or `"lg"`.
33+
Set sizes using `size` prop like `"sm"`, `"md"` or `"lg"`.
3434

3535
<Playground>
3636
<BlockList>
37-
<Button variant="primary" size="sm">
37+
<Button size="sm">
3838
Small
3939
</Button>
40-
<Button variant="primary">Medium</Button>
41-
<Button variant="primary" size="lg">
40+
<Button size="md">Medium</Button>
41+
<Button size="lg">
4242
Large
4343
</Button>
4444
</BlockList>
@@ -64,7 +64,7 @@ Disable using `disabled` prop.
6464
children: PropDesc.node,
6565
disabled: PropDesc.bool,
6666
size: PropDesc.oneOf(['sm', 'lg']),
67-
variant: PropDesc.oneOf(themeProp('btnVariants')).defaultTo('primary'),
67+
variant: PropDesc.oneOf(themeProp('colorVariants')).defaultTo('primary'),
6868
...getSystemPropDesc(Button),
6969
})}
7070
/>

docs/components/Checkbox.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Checkbox, FormCheck, FormCheckLabel } from '@smooth-ui/core-sc'
1111

1212
## Sizes
1313

14-
Set sizes using `size` prop like `"sm"` or `"lg"`.
14+
Set sizes using `size` prop like `"sm"`, `"md"` or `"lg"`.
1515

1616
<Playground>
1717
<FormCheck>

docs/components/Input.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { Input } from '@smooth-ui/core-sc'
1111

1212
## Sizes
1313

14-
Set heights using `size` prop like `"sm"` or `"lg"`.
14+
Set sizes using `size` prop like `"sm"`, `"md"` or `"lg"`.
1515

1616
<Playground>
1717
<BlockList>
1818
<Input size="sm" placeholder="Small" />
19-
<Input placeholder="Medium" />
19+
<Input size="md" placeholder="Medium" />
2020
<Input size="lg" placeholder="Large" />
2121
</BlockList>
2222
</Playground>

docs/components/Radio.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Radio, RadioGroup, FormCheck, FormCheckLabel } from '@smooth-ui/core-sc
1111

1212
## Sizes
1313

14-
Set sizes using `size` prop like `"sm"` or `"lg"`.
14+
Set sizes using `size` prop like `"sm"`, `"md"` or `"lg"`.
1515

1616
<Playground>
1717
<RadioGroup>
@@ -20,7 +20,7 @@ Set sizes using `size` prop like `"sm"` or `"lg"`.
2020
<FormCheckLabel htmlFor="sizeRadio1">Small</FormCheckLabel>
2121
</FormCheck>
2222
<FormCheck>
23-
<Radio id="sizeRadio2" name="sizeRadios" value="option2" />
23+
<Radio size="md" id="sizeRadio2" name="sizeRadios" value="option2" />
2424
<FormCheckLabel htmlFor="sizeRadio2">Medium</FormCheckLabel>
2525
</FormCheck>
2626
<FormCheck>

docs/components/Select.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { Select } from '@smooth-ui/core-sc'
1111

1212
## Sizes
1313

14-
Set heights using `size` prop like `"sm"` or `"lg"`.
14+
Set sizes using `size` prop like `"sm"`, `"md"` or `"lg"`.
1515

1616
<Playground>
1717
<BlockList>
1818
<Select size="sm" placeholder="Small" options={['One', 'Two']} />
19-
<Select placeholder="Medium" options={['Yes', 'No', 'Maybe']} />
19+
<Select size="md" placeholder="Medium" options={['Yes', 'No', 'Maybe']} />
2020
<Select size="lg" placeholder="Large" options={['Amazing', 'Great']} />
2121
</BlockList>
2222
</Playground>

docs/components/Textarea.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { Textarea } from '@smooth-ui/core-sc'
1111

1212
## Sizes
1313

14-
Set heights using `size` prop like `"sm"` or `"lg"`.
14+
Set sizes using `size` prop like `"sm"`, `"md"` or `"lg"`.
1515

1616
<Playground>
1717
<BlockList>
1818
<Textarea size="sm" placeholder="Small" />
19-
<Textarea placeholder="Medium" />
19+
<Textarea size="md" placeholder="Medium" />
2020
<Textarea size="lg" placeholder="Large" />
2121
</BlockList>
2222
</Playground>

docs/utilities/Toggler.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Toggler is a render-props component that provide a toggle behaviour.
1414
<Playground>
1515
<Toggler>
1616
{({ toggled, onToggle }) => (
17-
<Button variant="primary" onClick={onToggle}>
17+
<Button onClick={onToggle}>
1818
{toggled ? 'ON' : 'OFF'}
1919
</Button>
2020
)}
@@ -29,10 +29,10 @@ Toggler is a render-props component that provide a toggle behaviour.
2929
<div className="block-list">
3030
<div>{toggled ? '🌞' : '🌛'}</div>
3131
<div>
32-
<Button variant="primary" size="sm" onClick={() => onToggle(false)}>
32+
<Button size="sm" onClick={() => onToggle(false)}>
3333
Night
3434
</Button>{' '}
35-
<Button variant="primary" size="sm" onClick={() => onToggle(true)}>
35+
<Button size="sm" onClick={() => onToggle(true)}>
3636
Day
3737
</Button>
3838
</div>
@@ -48,7 +48,7 @@ You can define the default `toggled` value using `defaultToggled` property.
4848
<Playground>
4949
<Toggler defaultToggled>
5050
{({ toggled, onToggle }) => (
51-
<Button variant="primary" onClick={onToggle}>
51+
<Button onClick={onToggle}>
5252
{toggled ? 'ON' : 'OFF'}
5353
</Button>
5454
)}
@@ -62,7 +62,7 @@ You can listen when the element is toggled using `onToggle` property.
6262
<Playground>
6363
<Toggler onToggle={toggled => console.log('Toggled', toggled)}>
6464
{({ toggled, onToggle }) => (
65-
<Button variant="primary" onClick={onToggle}>
65+
<Button onClick={onToggle}>
6666
{toggled ? 'ON' : 'OFF'}
6767
</Button>
6868
)}

packages/core-em/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"access": "public"
2727
},
2828
"dependencies": {
29-
"classnames": "^2.2.6",
3029
"polished": "^2.2.0",
3130
"prop-types": "^15.6.2",
3231
"react-transition-group": "^2.5.0"

0 commit comments

Comments
 (0)