-
-
Save ashimon83/5b3d97046fe525d26a33db63267ddd2f to your computer and use it in GitHub Desktop.
blog202012 emotioin
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
/** @jsx jsx */ | |
import { css, jsx } from '@emotion/react' | |
const danger = css` | |
color: red; | |
` | |
const base = css` | |
background-color: darkgreen; | |
color: turquoise; | |
` | |
const extended = css` | |
${base}; // 直接拡張 | |
text-decoration: underline; | |
` | |
render( | |
<div> | |
<div css={base}>This will be turquoise</div> | |
<div css={[danger, base]}> // 配列で組み合わせることもできる | |
some description | |
</div> | |
<span css={danger}>other description</div> | |
{/* 別の種類のタグで有っても共通のクラスをつけたりすることも可能。 */} | |
{/* あまりやらないと思いますが、できてしまう。 */} | |
<div css={extended}>extended</div> | |
</div> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment