-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from styled-components to emotion
The switch is required in order to fix a problem with the order of global styles. ben-rogerson/twin.macro#277
- Loading branch information
Showing
6 changed files
with
180 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"presets": [ | ||
["@babel/preset-react", { "runtime": "automatic" }], | ||
"@emotion/babel-preset-css-prop", | ||
"@babel/preset-typescript" | ||
], | ||
"plugins": ["babel-plugin-twin", "babel-plugin-macros", "styled-components"] | ||
"plugins": ["babel-plugin-twin", "babel-plugin-macros"] | ||
} |
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
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,19 +1,9 @@ | ||
import "twin.macro"; | ||
import styledImport, { CSSProp, css as cssImport } from "styled-components"; | ||
import 'twin.macro' | ||
import styledImport from '@emotion/styled' | ||
import { css as cssImport } from '@emotion/react' | ||
|
||
declare module "twin.macro" { | ||
declare module 'twin.macro' { | ||
// The styled and css imports | ||
const styled: typeof styledImport; | ||
const css: typeof cssImport; | ||
} | ||
|
||
declare module "react" { | ||
// The css prop | ||
interface HTMLAttributes<T> extends DOMAttributes<T> { | ||
css?: CSSProp; | ||
} | ||
// The inline svg css prop | ||
interface SVGProps<T> extends SVGProps<SVGSVGElement> { | ||
css?: CSSProp; | ||
} | ||
const styled: typeof styledImport | ||
const css: typeof cssImport | ||
} |
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,13 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist/", | ||
"sourceMap": true, | ||
"noImplicitAny": true, | ||
"module": "commonjs", | ||
"target": "es5", | ||
"jsx": "react", | ||
"allowJs": true, | ||
"moduleResolution": "node", | ||
"esModuleInterop": true | ||
} | ||
} | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"moduleResolution": "node", | ||
"jsx": "preserve", | ||
"baseUrl": "./src", | ||
"noEmit": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"resolveJsonModule": true, | ||
"allowSyntheticDefaultImports": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"jsxImportSource": "@emotion/react" // Add the css prop | ||
}, | ||
"include": ["src"] | ||
} |
Oops, something went wrong.