๐ก ๋ฏธ๋ฆฌ๋ณด๋ ๊ฒฐ๋ก
๊ฐ๊ธ์ @mixin
์ ์ฌ์ฉํด๋ผ.
Why?
๋ฌด๋ถ๋ณํ@extend
์ฌ์ฉ ์ ์ฐ๊ด์ฑ ์๋ ๊ฐ๋ค์ด ํ ์ฅ์์ ๋ฌถ์ด๊ฒ ๋๊ณ ,
์์ค ์์๊ฐ ์ด๊ทธ๋ฌ์ ธ์ ํผ๋์ ์ค๋ค.
์ฐธ๊ณ : https://mytory.net/2016/12/23/when-to-use-extend-when-to-use-a-mixin.html
@mixin style-link-text($col) {
text-decoration: none;
text-transform: uppercase;
color: $col;
}
@include
์
๋ ฅ ํ ์ฌ์ฉ$color-text-white: #fff;
.btn-main {
@include style-link-text($color-text-white);
}
.btn-hot {
@include style-link-text($color-text-white);
}
.btn-main {
text-decoration: none;
text-transform: uppercase;
color: #fff;
}
.btn-hot {
text-decoration: none;
text-transform: uppercase;
color: #fff;
}
%
๋ฅผ ์
๋ ฅํ๊ณ ๋ฐ๋ก ๋ค์ ์ด๋ฆ์ ์ ์ธ%btn-placeholder {
padding: 10px;
display: inline-block;
text-align: center;
border-radius: 100px;
width: 100px;
@include style-link-text($color-text-white);
}
@extend
์
๋ ฅ ํ ์ฌ์ฉ.btn-main {
&:link {
@extend %btn-placeholder;
}
}
.btn-hot {
&:link {
@extend %btn-placeholder;
}
}
.btn-main:link,
.btn-hot:link {
padding: 10px;
display: inline-block;
text-align: center;
border-radius: 100px;
width: 100px;
@include style-link-text($color-text-white);
}