utils.scss에서 선언한 변수와 믹스인을 SassComponent.scss로 import하기
/*utils.scss*/
$red: red;
$orange: orange;
$yellow: yellow;
$green: green;
$blue: blue;
$indigo: indigo;
$violet: violet;
@mixin square($size) {
$calculated: 32px * $size;
width: $calculated;
height: $calculated;
}
@import "./styles/utils";
.SassComponent {
display: flex;
.box {
background: red;
cursor: pointer;
transition: all 0.3s ease-in;
&.red {
background: $red;
@include square(1);
}
&.orange {
background: $orange;
@include square(2);
}
&.yellow {
background: $yellow;
@include square(3);
}
&.green {
background: $green;
@include square(4);
}
&.blue {
background: $blue;
@include square(5);
}
&.indigo {
background: $indigo;
@include square(6);
}
&.violet {
background: $violet;
@include square(7);
}
&:hover {
background: black;
}
}
}
'프론트엔드관련 책예제실습정리 > 리기술요약' 카테고리의 다른 글
09컴퍼넌트스타일링 CSSModule을 활용한 클래스네임적용, global css 작성 (0) | 2021.06.23 |
---|---|
09컴퍼넌트스타일링 node-modules에서 라이브러리 불러오기(open-color, include-media) (0) | 2021.06.22 |
08hooks/커스텀 hook만들기 (0) | 2021.06.22 |
08hooks/useMemo,useCallback,useRef (0) | 2021.06.22 |
컴포넌트 반복 (0) | 2021.06.11 |