styled / css / scss문법 사용
예시**)**
src > styles > common.js
import { css } from 'styled-components'
export const flexCenter = css`
display:flex;
justify-content: center;
align-items: center;
`
src > pages > todo > components > title > title.js
import styled from 'styled-components'
import { flexCenter } from '../../../../styles/common'
function todoTitle () {
return <Wrapper>
투두리스트 타이틀입니다. <p>남은 할일 <span>0</span>개</p>
</Wrapper>
}
export default todoTitle;
const Wrapper = styled.div`
${flexCenter}
// scss 문법을 사용할 수 있음!
& > p{
color: red;
line-height: 48px;
& > span{
display: inline-block;
width: 48px;
height: 48px;
border-radius: 50%;
background-color: aqua;
text-align: center
}
}
`