본문 바로가기
React

styled-components 라이브러리 만들기

by 바나냥 2020. 10. 16.
// style.ts

const mt = (size: number) => css`
    margin-top: ${size}px;
`;

const mr = (size: number) => css`
    margin-right: ${size}px;
`;

const mb = (size: number) => css`
    margin-bottom: ${size}px;
`;

const ml = (size: number) => css`
    margin-left: ${size}px;
`;

export const Style = {
    margin: {
        mt,
        mr,
        mb,
        ml,
    },
};

 

// styled-components

import { Style } from '../'

.mb-0 {
        input {
            ${Style.margin.mb(0)}
        }
    }

댓글