-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add styled-components storybook example
This is mostly to prove that the updates work through PureComponent.
- Loading branch information
Showing
3 changed files
with
67 additions
and
14 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,30 +1,36 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, boolean } from '@storybook/addon-knobs/react'; | ||
|
||
import { | ||
LiveProvider, | ||
LiveEditor, | ||
LiveError, | ||
LivePreview | ||
} from '../src/index' | ||
import { LiveProvider, LiveEditor, LiveError, LivePreview } from '../src/index'; | ||
|
||
const code = (` | ||
const code = ` | ||
<strong> | ||
Hello World! | ||
Next Indent Level | ||
</strong> | ||
`).trim() | ||
`.trim(); | ||
|
||
const StyledLivePreview = styled(LivePreview)` | ||
background: green; | ||
color: white; | ||
padding: 3px; | ||
`; | ||
|
||
storiesOf('Live', module) | ||
.addDecorator(withKnobs) | ||
.add('default', () => ( | ||
<LiveProvider | ||
code={code} | ||
noInline={boolean('No inline evaluation', false)} | ||
> | ||
<LiveProvider code={code} noInline={boolean('No inline evaluation', false)}> | ||
<LiveEditor /> | ||
<LiveError /> | ||
<LivePreview /> | ||
</LiveProvider> | ||
)) | ||
.add('styled subcomponents', () => ( | ||
<LiveProvider code={code} noInline={boolean('No inline evaluation', false)}> | ||
<LiveEditor /> | ||
<LiveError /> | ||
<StyledLivePreview /> | ||
</LiveProvider> | ||
)); |
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 |
---|---|---|
|
@@ -10,6 +10,16 @@ | |
esutils "^2.0.2" | ||
js-tokens "^3.0.0" | ||
|
||
"@emotion/is-prop-valid@^0.6.8": | ||
version "0.6.8" | ||
resolved "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.6.8.tgz#68ad02831da41213a2089d2cab4e8ac8b30cbd85" | ||
dependencies: | ||
"@emotion/memoize" "^0.6.6" | ||
|
||
"@emotion/memoize@^0.6.6": | ||
version "0.6.6" | ||
resolved "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.6.6.tgz#004b98298d04c7ca3b4f50ca2035d4f60d2eed1b" | ||
|
||
"@storybook/addon-actions@^3.3.12": | ||
version "3.3.12" | ||
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-3.3.12.tgz#1bd2668918a62f32c0907af14946cdd0c6be66f5" | ||
|
@@ -2481,6 +2491,10 @@ crypto-random-string@^1.0.0: | |
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" | ||
|
||
css-color-keywords@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05" | ||
|
||
[email protected]: | ||
version "0.0.4" | ||
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" | ||
|
@@ -2527,6 +2541,14 @@ css-selector-tokenizer@^0.7.0: | |
fastparse "^1.1.1" | ||
regexpu-core "^1.0.0" | ||
|
||
css-to-react-native@^2.0.3: | ||
version "2.2.1" | ||
resolved "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.2.1.tgz#7f3f4c95de65501b8720c87bf0caf1f39073b88e" | ||
dependencies: | ||
css-color-keywords "^1.0.0" | ||
fbjs "^0.8.5" | ||
postcss-value-parser "^3.3.0" | ||
|
||
[email protected]: | ||
version "2.1.0" | ||
resolved "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd" | ||
|
@@ -3279,7 +3301,7 @@ fb-watchman@^2.0.0: | |
dependencies: | ||
bser "^2.0.0" | ||
|
||
fbjs@^0.8.0, fbjs@^0.8.16: | ||
fbjs@^0.8.0, fbjs@^0.8.16, fbjs@^0.8.5: | ||
version "0.8.17" | ||
resolved "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" | ||
dependencies: | ||
|
@@ -4881,6 +4903,10 @@ mem@^1.1.0: | |
dependencies: | ||
mimic-fn "^1.0.0" | ||
|
||
memoize-one@^4.0.0: | ||
version "4.0.2" | ||
resolved "https://registry.npmjs.org/memoize-one/-/memoize-one-4.0.2.tgz#3fb8db695aa14ab9c0f1644e1585a8806adc1aee" | ||
|
||
memory-fs@^0.4.0, memory-fs@~0.4.1: | ||
version "0.4.1" | ||
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" | ||
|
@@ -6128,7 +6154,7 @@ react-inspector@^2.2.2: | |
babel-runtime "^6.26.0" | ||
is-dom "^1.0.9" | ||
|
||
react-is@^16.4.2, react-is@^16.5.2: | ||
react-is@^16.3.1, react-is@^16.4.2, react-is@^16.5.2: | ||
version "16.5.2" | ||
resolved "https://registry.npmjs.org/react-is/-/react-is-16.5.2.tgz#e2a7b7c3f5d48062eb769fcb123505eb928722e3" | ||
|
||
|
@@ -7069,6 +7095,26 @@ style-loader@^0.19.1: | |
loader-utils "^1.0.2" | ||
schema-utils "^0.3.0" | ||
|
||
styled-components@^4.0.0-beta.8: | ||
version "4.0.0-beta.8" | ||
resolved "https://registry.npmjs.org/styled-components/-/styled-components-4.0.0-beta.8.tgz#90430b172ca96915481c0009db1dd76f024cf02a" | ||
dependencies: | ||
"@emotion/is-prop-valid" "^0.6.8" | ||
css-to-react-native "^2.0.3" | ||
memoize-one "^4.0.0" | ||
prop-types "^15.5.4" | ||
react-is "^16.3.1" | ||
stylis "^3.5.0" | ||
stylis-rule-sheet "^0.0.10" | ||
|
||
stylis-rule-sheet@^0.0.10: | ||
version "0.0.10" | ||
resolved "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz#44e64a2b076643f4b52e5ff71efc04d8c3c4a430" | ||
|
||
stylis@^3.5.0: | ||
version "3.5.3" | ||
resolved "https://registry.npmjs.org/stylis/-/stylis-3.5.3.tgz#99fdc46afba6af4deff570825994181a5e6ce546" | ||
|
||
supports-color@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" | ||
|