Sass 라이브러리 설치(open-color, include-media)
$yarn add open-color include-media
node_modules의 라이브러리 블러올시 내부경로 ~로 표기
768px media min 에서 background $oc-gray-9 로 변경
//utils.scss
@import "~include-media/dist/include-media";
@import "~open-color/open-color";
$red: red;
$orange: orange;
$yellow: yellow;
$green: green;
$blue: blue;
$indigo: indigo;
$violet: violet;
@mixin square($size) {
$calculated: 32px * $size;
width: $calculated;
height: $calculated;
}
//SassComponent.scss
@import "./styles/utils";
.SassComponent {
display: flex;
background: $oc-gray-2;
@include media("<768px") {
background: $oc-gray-9;
}
.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;
}
}
}
'프론트엔드관련 책예제실습정리 > 리기술요약' 카테고리의 다른 글
10 일정관리웹어플리케이션만들기 01 (0) | 2021.06.23 |
---|---|
09컴퍼넌트스타일링 CSSModule을 활용한 클래스네임적용, global css 작성 (0) | 2021.06.23 |
09컴퍼넌트스타일링 scss @import로 공통 믹스인 분리하기 (0) | 2021.06.22 |
08hooks/커스텀 hook만들기 (0) | 2021.06.22 |
08hooks/useMemo,useCallback,useRef (0) | 2021.06.22 |