Skip to content

Commit 13719db

Browse files
emmatownNoviny
authored andcommitted
Upgrade to emotion 10 in pretty-proptypes (#81)
* Upgrade to emotion 10 in pretty-proptypes * Change a thing back to how it was
1 parent 361a24b commit 13719db

File tree

17 files changed

+169
-898
lines changed

17 files changed

+169
-898
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "releases": [{ "name": "pretty-proptypes", "type": "major" }], "dependents": [] }

.changeset/poor-beds-occur/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade to emotion 10. If you've been using emotion-server to server render this package, you can remove it now because server rendering will work without it.

package.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@babel/runtime": "^7.4.4",
4141
"@babel/types": "^7.0.0-beta.56",
4242
"@changesets/cli": "^1.3.0",
43+
"@emotion/core": "^10.0.14",
4344
"ast-pretty-print": "^2.0.1",
4445
"babel-errors": "^1.1.1",
4546
"babel-eslint": "^10.0.1",
@@ -53,7 +54,6 @@
5354
"babel-type-scopes": "^1.1.0",
5455
"babylon": "^7.0.0-beta.22",
5556
"babylon-options": "^2.0.1",
56-
"emotion": "^9.1.1",
5757
"eslint": "^5.13.0",
5858
"eslint-config-airbnb": "^17.1.0",
5959
"eslint-config-prettier": "^4.0.0",
@@ -74,16 +74,8 @@
7474
"@babel/preset-env": "^7.4.4",
7575
"@babel/preset-flow": "^7.0.0",
7676
"@babel/preset-react": "^7.0.0",
77-
"babel-cli": "^6.26.0",
7877
"babel-jest": "^24.7.1",
79-
"babel-plugin-emotion": "^9.1.0",
80-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
81-
"babel-plugin-transform-class-properties": "^6.24.1",
82-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
83-
"babel-plugin-transform-runtime": "^6.23.0",
84-
"babel-preset-env": "^1.6.1",
85-
"babel-preset-flow": "^6.23.0",
86-
"babel-preset-react": "^6.24.1",
78+
"babel-plugin-emotion": "^10.0.14",
8779
"enzyme": "^3.3.0",
8880
"enzyme-adapter-react-16": "^1.1.1",
8981
"flow-bin": "^0.98.0",

packages/pretty-proptypes/package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,14 @@
1515
"license": "MIT",
1616
"dependencies": {
1717
"@babel/runtime": "^7.4.4",
18-
"emotion": "^9.1.1",
18+
"@emotion/core": "^10.0.14",
1919
"kind2string": "^0.6.2",
2020
"react-markings": "^1.2.0"
2121
},
2222
"files": [
2323
"dist"
2424
],
2525
"devDependencies": {
26-
"babel-cli": "^6.26.0",
27-
"babel-plugin-emotion": "^9.1.0",
28-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
29-
"babel-plugin-transform-class-properties": "^6.24.1",
30-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
31-
"babel-plugin-transform-runtime": "^6.23.0",
32-
"babel-preset-env": "^1.6.1",
33-
"babel-preset-flow": "^6.23.0",
34-
"babel-preset-react": "^6.24.1",
3526
"enzyme": "^3.3.0",
3627
"enzyme-adapter-react-16": "^1.1.1",
3728
"extract-react-types": "^0.21.0",
@@ -43,4 +34,4 @@
4334
"peerDependencies": {
4435
"react": ">=16"
4536
}
46-
}
37+
}

packages/pretty-proptypes/src/PrettyConvert/AddBrackets.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @flow
2-
import React, { Component, Fragment, type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { Component, Fragment, type Node } from 'react';
35
import { colors } from '../components/constants';
46

57
const StateBit = ({
@@ -18,7 +20,7 @@ const StateBit = ({
1820
<button
1921
type="button"
2022
onClick={onClick}
21-
css={`
23+
css={css`
2224
background-color: ${isHovered ? colors.P300 : colors.N20};
2325
color: ${isHovered ? 'white' : colors.subtleText};
2426
border: 0;

packages/pretty-proptypes/src/PrettyConvert/Toggle.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @flow
2-
import React, { Component, type Node, type ElementRef } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { Component, type Node, type ElementRef } from 'react';
35

46
const Collapse = ({
57
height,
@@ -13,7 +15,7 @@ const Collapse = ({
1315
}) => (
1416
<div
1517
ref={innerRef}
16-
css={`
18+
css={css`
1719
height: ${isCollapsed ? 0 : `${height}px`};
1820
overflow: hidden;
1921
transition: height 260ms cubic-bezier(0.2, 0, 0, 1);

packages/pretty-proptypes/src/PrettyConvert/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @flow
2-
import React, { Component, type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { Component, type Node } from 'react';
35
import { resolveFromGeneric } from 'kind2string';
46
import { gridSize } from '../components/constants';
57
import allComponents, { type Components } from '../components';
@@ -8,7 +10,7 @@ import prettyConvert, { SIMPLE_TYPES } from './converters';
810

911
const Wrapper = (props: { children: Node }) => (
1012
<code
11-
css={`
13+
css={css`
1214
display: inline-block;
1315
font-size: 0.8rem;
1416
line-height: 1.4;

packages/pretty-proptypes/src/Prop/Heading.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @flow
2-
import React, { type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
35
import { colors, gridSize, borderRadius } from '../components/constants';
46

57
const Heading = ({ children, ...rest }: { children: Node }) => (
68
<h3
7-
css={`
9+
css={css`
810
border-bottom: 2px solid ${colors.N20};
911
font-size: 0.9rem;
1012
font-weight: normal;
@@ -20,7 +22,7 @@ const Heading = ({ children, ...rest }: { children: Node }) => (
2022

2123
const HeadingDefault = (props: { children: Node }) => (
2224
<code
23-
css={`
25+
css={css`
2426
color: ${colors.subtleText};
2527
`}
2628
{...props}
@@ -29,7 +31,7 @@ const HeadingDefault = (props: { children: Node }) => (
2931

3032
const HeadingRequired = (props: { children: Node }) => (
3133
<code
32-
css={`
34+
css={css`
3335
color: ${colors.R500};
3436
`}
3537
{...props}
@@ -38,7 +40,7 @@ const HeadingRequired = (props: { children: Node }) => (
3840

3941
const HeadingType = (props: { children: Node }) => (
4042
<code
41-
css={`
43+
css={css`
4244
background: ${colors.N20};
4345
border-radius: ${borderRadius}px;
4446
color: ${colors.N300};
@@ -51,7 +53,7 @@ const HeadingType = (props: { children: Node }) => (
5153

5254
const HeadingName = (props: { children: Node }) => (
5355
<code
54-
css={`
56+
css={css`
5557
background: ${colors.B50};
5658
color: ${colors.B500};
5759
border-radius: ${borderRadius}px;

packages/pretty-proptypes/src/Prop/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @flow
2-
import React, { Component, type ComponentType, type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { Component, type ComponentType, type Node } from 'react';
35
import md from 'react-markings';
46
import { gridSize } from '../components/constants';
57
import PrettyPropType from '../PrettyConvert';
@@ -8,7 +10,7 @@ import type { CommonProps } from '../types';
810

911
const PropTypeWrapper = (props: { children: Node }) => (
1012
<div
11-
css={`
13+
css={css`
1214
margin-top: ${gridSize * 4}px;
1315
`}
1416
{...props}

packages/pretty-proptypes/src/Props/Wrapper.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @flow
2-
import React, { type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
35
import { gridSize } from '../components/constants';
46

57
const Wrapper = (props: { children: Node }) => (
68
<div
7-
css={`
9+
css={css`
810
margin-top: ${gridSize * 1.5}px;
911
1012
@media (min-width: 780px) {
@@ -18,7 +20,7 @@ const Wrapper = (props: { children: Node }) => (
1820

1921
const H2 = ({ children, ...rest }: { children: Node }) => (
2022
<h2
21-
css={`
23+
css={css`
2224
margintop: 1em;
2325
`}
2426
{...rest}

packages/pretty-proptypes/src/components/Button.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// @flow
2-
import React from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
34

45
const Button = (props: { isCollapsed: boolean }) => (
56
<button
67
type="button"
7-
css={`
8+
css={css`
89
background: linear-gradient(to bottom, #1f8be6 0%, #1178ce 100%) #1385e5;
910
border-width: 1px;
1011
border-style: solid;

packages/pretty-proptypes/src/components/Description.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// @flow
2-
import React, { type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
35

46
const ReadmeDescription = (props: { children: Node }) =>
57
typeof props.children === 'string' ? (
68
<p {...props} />
79
) : (
810
<div
9-
css={`
11+
css={css`
1012
margin-top: 12px;
1113
`}
1214
{...props}

packages/pretty-proptypes/src/components/Indent.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @flow
2-
import React, { type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
35

46
export default function Indent(props: { children: Node }) {
57
return (
68
<div
7-
css={`
9+
css={css`
810
padding-left: 1.3em;
911
`}
1012
{...props}

packages/pretty-proptypes/src/components/Outline.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @flow
2-
import React, { type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
35
import { colors } from './constants';
46

57
const Outline = (props: { children: Node }) => (
68
<span
7-
css={`
9+
css={css`
810
color: ${colors.subtleText};
911
line-height: 1;
1012
`}

packages/pretty-proptypes/src/components/Required.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @flow
2-
import React, { type Node } from 'react';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
35
import { colors } from './constants';
46

57
const Required = (props: { children: Node }) => (
68
<span
7-
css={`
9+
css={css`
810
color: ${colors.R500};
911
`}
1012
{...props}

packages/pretty-proptypes/src/components/Type.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @flow
2-
import React, { type Node } from 'react';
3-
import { css } from 'emotion';
2+
/** @jsx jsx */
3+
import { jsx, css } from '@emotion/core';
4+
import { type Node } from 'react';
45
import { borderRadius, colors } from './constants';
56

67
const baseType = css`
@@ -26,13 +27,13 @@ const stringType = css`
2627

2728
const functionType = css``;
2829

29-
const Type = (props: { children: Node }) => <span className={baseType} {...props} />;
30+
const Type = (props: { children: Node }) => <span css={baseType} {...props} />;
3031

31-
const TypeMeta = (props: { children: Node }) => <span className={typeMeta} {...props} />;
32+
const TypeMeta = (props: { children: Node }) => <span css={typeMeta} {...props} />;
3233

33-
const StringType = (props: { children: Node }) => <span className={stringType} {...props} />;
34+
const StringType = (props: { children: Node }) => <span css={stringType} {...props} />;
3435

35-
const FunctionType = (props: { children: Node }) => <span className={functionType} {...props} />;
36+
const FunctionType = (props: { children: Node }) => <span css={functionType} {...props} />;
3637

3738
export { TypeMeta, StringType, FunctionType };
3839
export default Type;

0 commit comments

Comments
 (0)