From b08e0065ddf8bf1db95054c0855e45cc4e7f9727 Mon Sep 17 00:00:00 2001 From: Nathan Marks Date: Tue, 11 Jun 2019 16:01:23 -0400 Subject: [PATCH] Use emotion --- babel.config.js | 3 +- docs/components.md | 14 + lib/styleguide/Wrapper.js | 19 +- package.json | 4 +- src/base/RadioCheckboxBase.js | 14 +- src/components/Buttons/Button.js | 9 +- src/components/Buttons/Checkbox.js | 2 +- src/components/Buttons/CircleButton.js | 7 +- src/components/Buttons/Radio.js | 2 +- src/components/Buttons/RadioGroup.js | 2 +- src/components/Buttons/Switch.js | 8 +- src/components/Forms/FloatingLabel.js | 17 +- src/components/Forms/HelperText.js | 2 +- src/components/Forms/MaskedTextField.js | 15 +- src/components/Forms/Select.js | 18 +- src/components/Forms/ServerError.js | 4 +- src/components/Forms/TextField.js | 13 +- src/components/Forms/TextFieldHint.js | 4 +- src/components/Forms/ValidationError.js | 4 +- src/components/Grid/Column.js | 5 +- src/components/Grid/Grid.js | 5 +- src/components/Grid/Row.js | 5 +- src/components/Icon/Icon.js | 5 +- src/components/Link/Link.js | 5 +- src/components/Loading/LoadingBox.js | 42 +- src/components/Menus/DropdownMenu.js | 10 +- src/components/Menus/Menu.js | 2 +- src/components/Menus/MenuDivider.js | 2 +- src/components/Menus/MenuItem.js | 14 +- .../NavigationPills/NavigationPill.js | 7 +- .../NavigationPills/NavigationPills.js | 9 +- src/components/Pill/Pill.js | 5 +- src/components/SVGIcon/SVGIcon.js | 3 +- src/components/ScrollTrack/ScrollTrack.js | 16 +- .../ScrollTrack/docs/ScrollTrack.md | 2 +- src/components/Tooltip/InnerToolTip.js | 2 +- src/components/Tooltip/Tooltip.js | 2 +- src/components/Tooltip/TooltipArrow.js | 2 +- src/components/Tooltip/TooltipPosition.js | 2 +- src/components/Transitions/Fade.js | 2 +- src/components/Transitions/Grow.js | 2 +- src/components/Transitions/Slide.js | 4 +- src/components/Typography/Text.js | 5 +- src/styles/SetStyles.js | 5 +- styleguide.config.js | 113 ++- webpack.config.js | 3 +- webpack.release.config.js | 59 +- yarn.lock | 669 ++++++++++++++++-- 48 files changed, 851 insertions(+), 317 deletions(-) diff --git a/babel.config.js b/babel.config.js index dd23a3de..cb140b2a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,6 +12,7 @@ module.exports = api => { }, ], '@babel/preset-react', + '@emotion/babel-preset-css-prop', ], plugins: [ [ @@ -22,7 +23,7 @@ module.exports = api => { ], ['@babel/plugin-proposal-class-properties', { loose: true }], ['@babel/plugin-proposal-object-rest-spread', { loose: true }], - ['@babel/transform-runtime', { useESModules: isTest ? false : true }], + ['@babel/transform-runtime', { useESModules: !isTest }], '@babel/plugin-transform-react-constant-elements', ], } diff --git a/docs/components.md b/docs/components.md index e69de29b..4a6a4720 100644 --- a/docs/components.md +++ b/docs/components.md @@ -0,0 +1,14 @@ +- [Buttons] (#/Components/Buttons) +- [Forms] (#/Components/Forms) +- [Typography] (#/Components/Typography) +- [Grid] (#/Components/Grid) +- [Icon] (#/Components/Icon) +- [SVGIcon] (#/Components/SVGIcon) +- [Link] (#/Components/Link) +- [Loading] (#/Components/Loading) +- [Menus] (#/Components/Menus) +- [NavigationPills] (#/Components/NavigationPills) +- [Pill] (#/Components/Pill) +- [ScrollTrack] (#/Components/ScrollTrack) +- [Tooltip] (#/Components/Tooltip) +- [Transitions] (#/Components/Transitions) diff --git a/lib/styleguide/Wrapper.js b/lib/styleguide/Wrapper.js index 2f96d2b6..c19e4367 100644 --- a/lib/styleguide/Wrapper.js +++ b/lib/styleguide/Wrapper.js @@ -1,14 +1,11 @@ -import React, { Component } from 'react'; -import { StyleRoot } from 'radium' +import React from 'react' import SetStyles from '../../src/styles/SetStyles' -export default class Wrapper extends Component { - render() { - return ( - - - { this.props.children } - - ) - } +export default function Wrapper(props) { + return ( + <> + + {props.children} + + ) } diff --git a/package.json b/package.json index 1d49e743..152557a2 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "@babel/plugin-transform-runtime": "7.4.4", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", + "@emotion/babel-preset-css-prop": "10.0.9", "@instacart/eslint-config": "0.1.9", "@instacart/prettier-config": "0.1.1", "@svgr/cli": "4.3.0", @@ -68,7 +69,6 @@ "jest": "^24.8.0", "prettier": "1.16.4", "prompt": "^1.0.0", - "radium": "^0.22.0", "react": "16.4.2", "react-dom": "16.4.2", "react-styleguidist": "9.0.9", @@ -83,6 +83,7 @@ }, "dependencies": { "@babel/runtime": "^7.1.2", + "@emotion/core": "10.0.10", "js-yaml": "3.13.1", "lodash.isequal": "^4.5.0", "react-text-mask": "^5.3.0", @@ -94,7 +95,6 @@ }, "peerDependencies": { "prop-types": "^15.0.0 || ^16.0.0", - "radium": ">=0.18.0", "react": "^15.0.0 || ^16.0.0", "react-dom": "^15.0.0 || ^16.0.0", "react-transition-group": "^2.2.1" diff --git a/src/base/RadioCheckboxBase.js b/src/base/RadioCheckboxBase.js index b25e87a2..46f8e99a 100644 --- a/src/base/RadioCheckboxBase.js +++ b/src/base/RadioCheckboxBase.js @@ -1,6 +1,5 @@ import React from 'react' import PropTypes from 'prop-types' -import Radium from 'radium' import colors from '../styles/colors' import withTheme from '../styles/themer/withTheme' import { themePropTypes } from '../styles/themer/utils' @@ -113,13 +112,13 @@ class RadioCheckboxBase extends React.PureComponent { const internalStyle = getStyles(this.props) return ( -
+
{renderInputButton(isSelected, getInputStyles(this.props, this.state))} + {this.renderInputBtn()} - @@ -158,4 +154,4 @@ class RadioCheckboxBase extends React.PureComponent { } } -export default withTheme(Radium(RadioCheckboxBase)) +export default withTheme(RadioCheckboxBase) diff --git a/src/components/Buttons/Button.js b/src/components/Buttons/Button.js index ec6fe2e5..7941e441 100644 --- a/src/components/Buttons/Button.js +++ b/src/components/Buttons/Button.js @@ -1,6 +1,5 @@ import React from 'react' import PropTypes from 'prop-types' -import Radium from 'radium' import Icon from '../Icon/Icon' import withTheme from '../../styles/themer/withTheme' import { themePropTypes } from '../../styles/themer/utils' @@ -213,7 +212,7 @@ const Button = props => { disabled: props.disabled, tabIndex: props.tabIndex, type: props.type, - style: [ + css: [ baseStyles, sizeStyles[props.size], snacksStyles[props.snacksStyle][props.disabled ? 'disabled' : 'base'], @@ -249,7 +248,7 @@ const Button = props => { return ( {icon} - + {props.children} ) @@ -259,7 +258,7 @@ const Button = props => { return ( {props.children} - + {icon} ) @@ -333,4 +332,4 @@ Button.defaultProps = { elementAttributes: {}, } -export default withTheme(Radium(Button)) +export default withTheme(Button) diff --git a/src/components/Buttons/Checkbox.js b/src/components/Buttons/Checkbox.js index 3f391069..85811d03 100644 --- a/src/components/Buttons/Checkbox.js +++ b/src/components/Buttons/Checkbox.js @@ -6,7 +6,7 @@ import checkboxSelectedSvg from '../../assets/checkboxSelected.svg' const renderInputButton = (isSelected, style) => { const SvgComponent = isSelected ? checkboxSelectedSvg : checkboxBaseSvg - return