Last active
August 18, 2017 21:24
-
-
Save SaraVieira/c19e7fe74da574fe67af5766c7f0f4b7 to your computer and use it in GitHub Desktop.
Styled Components article
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 React from 'react'; | |
import styled from 'styled-components'; | |
const Section = styled.main` | |
display: flex; | |
flex-direction: column; | |
background: #fff; | |
`; | |
const Paragraph = styled.p` | |
font-size: 14px; | |
line-height: 18px; | |
color: #4a4a4a; | |
margin-bottom: 20px; | |
`; | |
const Button = styled.button` | |
display: inline-block; | |
border-radius: 3px; | |
padding: 0.5rem 0; | |
margin: 0.5rem 1rem; | |
width: 11rem; | |
background: transparent; | |
color: white; | |
border: 2px solid white; | |
${p => p && p.secondary` | |
background: white; | |
color: palevioletred; | |
`} | |
` | |
const Main = () => ( | |
<Section> | |
<Paragraph> | |
Look at my buttons, they are amazing buttons ! | |
</Paragraph> | |
<Button type="primary"> | |
A Primary Button | |
</Button> | |
<Button type="secondary"> | |
And I am a secondary | |
</Button> | |
</Section> | |
); | |
export default Main; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment