January 06, 2020
import styled from 'styled-components'
const JyComponent = styled.div`
font-size: 2rem;
`
const JyInput = styled('input')`
bacground: red;
const STyledLink = styled(Link)`
color: white;
`
import styled, { css } from 'styled-components'
&:hover {
background: rgba(255, 255, 255, 0.9);
}
${props => props.inverted && css`
background: none;
border: 2px solid white;
color: white;
&:hover {
background: white;
color: black;
}
`};
<button>안녕하세요</button>
<button inverted={true}>재영하이</button>
const sizes = {
desktop: 1024,
tablet: 768,
}
const media = Object.keys(sizes).reduce((acc, labe) => {
acc[label] = (...args) => css`
@media (max-width: ${sizes[label] / 16}em) {
${css(...args)};
}
`
return acc
}, {})
const Box = styled.div`
background: ...
...
...
${media.desktop`width:768px;`}
$(media.tablet`width:100%;`};
`;