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
// src/blocks/Card/index.js | |
import styled from 'styled-components'; | |
import Header from './Header'; | |
import Image from './Image'; | |
import Text from './Text'; | |
import Title from './Title'; | |
const Card = styled.div` |
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
// SomeComponent.js | |
import Card from './blocks/Card'; | |
... | |
<Card> | |
<Card.Header> | |
<Card.Image | |
alt=”bob-ross-headshot” | |
src=”www.example.com/bob-ross.jpg” |
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
├ src/ | |
├── blocks/ | |
| ├── Card/ | |
| | ├── Header.js // <- Element | |
| | ├── Image.js // <- Element | |
| | ├── Text.js // <- Element | |
| | ├── Title.js // <- Element | |
| | └── index.js // <- Block | |
├── elements/ | |
| ├── A.js // <- Element |
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
// lib/elements/A/index.js | |
import styled from 'styled-components'; | |
... | |
const A = styled.a` | |
color: #263238; | |
text-decoration: none; | |
transition: color 0.2s ease; | |
&:hover { | |
color: #0097a7; |
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
const modifierConfig = { | |
darkGreyText: ({ theme }) => ` | |
color: ${theme.colors.base.text}; | |
`, | |
midGreyText: ({ theme }) => ` | |
color: ${theme.colors.base.textLight}; | |
`, | |
uppercase: () => ` |
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
<A | |
href="https://example.com" | |
modifiers={['darkGreyText', 'uppercase']} | |
/> |
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
import Card from './blocks/Card'; | |
import CardHeader from './blocks/Card/Header'; | |
import CardImage from './blocks/Card/Image'; | |
import CardText from './blocks/Card/Text'; | |
import CardTitle from './blocks/Card/Title'; |
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
import Card from './blocks/Card'; |
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
$ git clone [email protected]:alanbsmith/jest-snapshot-example.git | |
$ cd jest-snapshot-example | |
$ yarn install |
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
$ yarn lint:js | |
$ yarn lint:js:watch |