-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for emotion (#694)
* feat: add support to emotion * feat: judge emtion config before applying swc emotion transform
- Loading branch information
1 parent
71f7c47
commit f8603e2
Showing
10 changed files
with
317 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { css } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
import ReactDOM from 'react-dom/client'; | ||
import React from 'react'; | ||
|
||
const style = css` | ||
color: hotpink; | ||
`; | ||
|
||
const DivContainer = styled.div({ | ||
background: 'red', | ||
}); | ||
|
||
const SpanContainer = styled('span')({ | ||
background: 'yellow', | ||
}); | ||
|
||
const Child = styled.div` | ||
color: red; | ||
`; | ||
|
||
const Parent = styled.div` | ||
${Child} { | ||
color: green; | ||
} | ||
`; | ||
|
||
const App = () => { | ||
return [ | ||
<div css={style}>Hello emotion</div>, | ||
<DivContainer>red div</DivContainer>, | ||
<SpanContainer>yellow span</SpanContainer>, | ||
<Parent> | ||
<Child>Green because I am inside a Parent</Child> | ||
</Parent>, | ||
<Child>Red because I am not inside a Parent</Child>, | ||
]; | ||
}; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render(<App />); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"emotion": true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"dependencies": { | ||
"@emotion/react": "^11.11.1", | ||
"@emotion/styled": "^11.11.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script src="index.js"></script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.