Completely move to emotion 10

This commit is contained in:
Pavan Kumar Sunkara 2018-09-19 18:40:37 +02:00
parent 84fd7939f7
commit d4e65cc7ed
6 changed files with 57 additions and 53 deletions

View File

@ -35,7 +35,6 @@
"@storybook/core": "4.0.0-alpha.21", "@storybook/core": "4.0.0-alpha.21",
"babel-plugin-react-docgen": "^2.0.0-babel7.0", "babel-plugin-react-docgen": "^2.0.0-babel7.0",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"emotion": "^9.2.6",
"global": "^4.3.2", "global": "^4.3.2",
"lodash.flattendeep": "^4.4.0", "lodash.flattendeep": "^4.4.0",
"prop-types": "^15.6.2", "prop-types": "^15.6.2",

View File

@ -118,7 +118,7 @@ Then add the following code to the register.js.
```js ```js
import React from 'react'; import React from 'react';
import addons from '@storybook/addons'; import addons from '@storybook/addons';
import styled from 'emotion'; import styled from '@emotion/styled';
const NotesPanel = styled.div({ const NotesPanel = styled.div({
margin: 10, margin: 10,

View File

@ -35,7 +35,6 @@
"@storybook/podda": "^1.2.3", "@storybook/podda": "^1.2.3",
"@storybook/react-komposer": "^2.0.4", "@storybook/react-komposer": "^2.0.4",
"deep-equal": "^1.0.1", "deep-equal": "^1.0.1",
"emotion": "^9.2.8",
"events": "^3.0.0", "events": "^3.0.0",
"fuse.js": "^3.2.1", "fuse.js": "^3.2.1",
"global": "^4.3.2", "global": "^4.3.2",

View File

@ -5,8 +5,7 @@ import { polyfill } from 'react-lifecycles-compat';
import ReactModal from 'react-modal'; import ReactModal from 'react-modal';
import FuzzySearch from 'react-fuzzy'; import FuzzySearch from 'react-fuzzy';
import { withCSSContext } from '@emotion/core'; import { css, withCSSContext } from '@emotion/core';
import { css } from 'emotion';
const formatStories = stories => { const formatStories = stories => {
const formattedStories = []; const formattedStories = [];
@ -102,12 +101,15 @@ class SearchBox extends React.Component {
isOpen={showSearchBox} isOpen={showSearchBox}
onAfterOpen={this.onModalOpen} onAfterOpen={this.onModalOpen}
onRequestClose={onClose} onRequestClose={onClose}
className={css({ className={
css({
fontSize: theme.mainTextColor, fontSize: theme.mainTextColor,
fontFamily: theme.mainTextFace, fontFamily: theme.mainTextFace,
color: theme.mainTextColor, color: theme.mainTextColor,
})} }).name
overlayClassName={css({ }
overlayClassName={
css({
position: 'fixed', position: 'fixed',
height: '100vh', height: '100vh',
width: '100vw', width: '100vw',
@ -120,7 +122,8 @@ class SearchBox extends React.Component {
bottom: 0, bottom: 0,
background: theme.overlayBackground, background: theme.overlayBackground,
zIndex: 1, zIndex: 1,
})} }).name
}
contentLabel="Search" contentLabel="Search"
shouldReturnFocusAfterClose={false} shouldReturnFocusAfterClose={false}
> >

View File

@ -1,10 +1,9 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { withCSSContext } from '@emotion/core';
import { css } from 'emotion';
import ReactModal from 'react-modal'; import ReactModal from 'react-modal';
import { css, withCSSContext } from '@emotion/core';
const Command = styled.b( const Command = styled.b(
({ isLast, isFirst, theme }) => { ({ isLast, isFirst, theme }) => {
@ -140,7 +139,8 @@ function ShortcutsHelp({ isOpen, onClose, platform }, { theme }) {
<ReactModal <ReactModal
isOpen={isOpen} isOpen={isOpen}
onRequestClose={onClose} onRequestClose={onClose}
className={css({ className={
css({
position: 'absolute', position: 'absolute',
border: theme.mainBorder, border: theme.mainBorder,
borderRadius: theme.mainBorderRadius, borderRadius: theme.mainBorderRadius,
@ -156,8 +156,10 @@ function ShortcutsHelp({ isOpen, onClose, platform }, { theme }) {
fontSize: theme.mainTextColor, fontSize: theme.mainTextColor,
fontFamily: theme.mainTextFace, fontFamily: theme.mainTextFace,
color: theme.mainTextColor, color: theme.mainTextColor,
})} }).name
overlayClassName={css({ }
overlayClassName={
css({
position: 'fixed', position: 'fixed',
top: 0, top: 0,
left: 0, left: 0,
@ -165,7 +167,8 @@ function ShortcutsHelp({ isOpen, onClose, platform }, { theme }) {
bottom: 0, bottom: 0,
background: theme.overlayBackground, background: theme.overlayBackground,
zIndex: 1, zIndex: 1,
})} }).name
}
contentLabel="Shortcuts" contentLabel="Shortcuts"
> >
<Shortcuts appShortcuts={getShortcuts(platform)} /> <Shortcuts appShortcuts={getShortcuts(platform)} />

View File

@ -6741,7 +6741,7 @@ emojis-list@^2.0.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
emotion@9.2.8, emotion@^9.2.6, emotion@^9.2.8: emotion@9.2.8:
version "9.2.8" version "9.2.8"
resolved "https://registry.yarnpkg.com/emotion/-/emotion-9.2.8.tgz#b89e754be1a109f4e47ff0031928f94e40d7984a" resolved "https://registry.yarnpkg.com/emotion/-/emotion-9.2.8.tgz#b89e754be1a109f4e47ff0031928f94e40d7984a"
dependencies: dependencies: