This repository has been archived by the owner on May 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add theme support in Button (#53)
- Loading branch information
1 parent
124a874
commit 4fd581a
Showing
7 changed files
with
98 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
Button | ||
|
||
Default Button | ||
```js | ||
<Button>Button</Button> | ||
``` | ||
``` | ||
|
||
Themed Button | ||
```js | ||
const { ThemeProvider } = require('styled-components'); | ||
|
||
const theme = { | ||
button_borderWidth: '4px', | ||
button_borderImage: 'linear-gradient(to bottom, #b732ff, #8017ff) 1', | ||
button_color: 'aliceblue', | ||
button_backgroundImage: 'linear-gradient(to top, #b732ff, #8017ff)', | ||
}; | ||
|
||
<ThemeProvider theme={theme}> | ||
<Button>Themed Button</Button> | ||
</ThemeProvider> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Button does not crash 1`] = ` | ||
<div | ||
className="sc-bdVaJa icTUIk" | ||
<button | ||
className="sc-bdVaJa ldKojJ" | ||
> | ||
title | ||
</div> | ||
</button> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"button_borderWidth": "1px", | ||
"button_borderColor": "#303d41", | ||
"button_borderImage": "none", | ||
"button_color": "#303d41", | ||
"button_backgroundColor": "#fff", | ||
"button_backgroundImage": "none" | ||
} |
14 changes: 12 additions & 2 deletions
14
src/components/RadioButton/__snapshots__/RadioButton.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`RadioButton does not crash 1`] = ` | ||
<styled.div | ||
<styled.button | ||
className="sc-bwzfXH goITcP" | ||
theme={ | ||
Object { | ||
"button_backgroundColor": "#fff", | ||
"button_backgroundImage": "none", | ||
"button_borderColor": "#303d41", | ||
"button_borderImage": "none", | ||
"button_borderWidth": "1px", | ||
"button_color": "#303d41", | ||
} | ||
} | ||
value={true} | ||
> | ||
title | ||
</styled.div> | ||
</styled.button> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import buttonTheme from './components/Button/defaultTheme.json'; | ||
import inputRangeTheme from './components/InputRange/defaultTheme.json'; | ||
import legendRangeTheme from './components/Legend/defaultTheme.json'; | ||
|
||
export default { | ||
...buttonTheme, | ||
...inputRangeTheme, | ||
...legendRangeTheme | ||
}; |