ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฆฌํŒฉํ† ๋งํ•ด์•ผ ๋  ์‚ฌํ•ญ

๊ด€๋ จ ์ด๋ฏธ์ง€

 

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋™์ผํ•œ Feed Style ์†์„ฑ ๊ฐ’์„ ์ง€๋‹ˆ๊ณ  ์žˆ์ง€๋งŒ ์•ˆ์— ๋“ค์–ด๊ฐ€๋Š” ์ด๋ฏธ์ง€์˜ Layout๋งŒ์ด ๋‹ค๋ฅธ ๋‘ UI ์š”์†Œ๊ฐ€ ์žˆ๋‹ค.

์ „์ž์˜ Feed์—๋Š” ๋‹จ์ผ ์ด๋ฏธ์ง€๋งŒ์ด ๋“ค์–ด๊ฐ€๋Š” ๋ฐ˜๋ฉด์— ํ›„์ž์˜ Feed์—๋Š” Grid Layout ํ˜•์‹์œผ๋กœ ์ด 4์žฅ์˜ ์ด๋ฏธ์ง€๊ฐ€ ๋“ค์–ด๊ฐ„๋‹ค.

 

๋“ค์–ด๊ฐ€๋Š” ์ด๋ฏธ์ง€์˜ ๊ฐฏ์ˆ˜๊ฐ€ ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ์™€ ๋”๋ถˆ์–ด ์„ธ๋ถ€ ์†์„ฑ ๊ฐ’์„ ๋‹ฌ๋ฆฌ ํ•ด์ฃผ์–ด์•ผ ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ฒ˜์Œ์—๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด

๊ฐ Feed ์†์„ฑ ๊ฐ’์— Style ๊ฐ’์„ ์ฃผ์—ˆ๋‹ค.

.moviePosterQuarter { // Grid ํ˜•์‹์˜ Feed
    width: 95%;
    height: 95%;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
 }
 
 ( ... )
 
 .moviePoster { // ๋‹จ์ผ ํ˜•์‹์˜ Feed
    width: 100%;
    height: 84%;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
 }

์ด๋ ‡๊ฒŒ Style ๊ฐ’์„ ์„ค์ •ํ•ด ์ค€ ๋’ค์— ์ƒ๊ฐํ•ด๋ณด๋‹ˆ, ๋‘ Feed ๋‚ด ์ด๋ฏธ์ง€ ์†์„ฑ ๊ฐ’์—์„œ ๋‹ฌ๋ผ์ง€๋Š” ๊ฑด width ๊ฐ’๊ณผ height ๊ฐ’ ๋ฟ์ด๋ผ๋Š”๊ฑธ ๊นจ๋‹ฌ์•˜๋‹ค.

์ง€๊ธˆ์€  ๊ทธ ๋Œ€์ƒ์ด ๋‘ ๊ฐœ์˜ ์š”์†Œ๊ฐ€ ์†์„ฑ ๋ฟ์ด์ง€๋งŒ ํ”„๋กœ์ ํŠธ ๋‚ด์—์„œ ์ด๋Ÿฐ ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์•„์ง€๋ฉด ์ฝ”๋“œ๊ฐ€ ๋น„ํšจ์œจ์ ์ด๊ฒŒ ๋  ๊ฑฐ๋ผ๋Š” ์ƒ๊ฐ์— ๋ฆฌํŒฉํ† ๋ง์„ ํ•ด๋ณด๊ธฐ๋กœ ํ–ˆ๋‹ค.

 

๋ฌธ์ œ๋Š” ์ด ๋‘ ๊ฐ’๋งŒ์„ ๋™์ ์œผ๋กœ ๋ณ€ํ•˜๊ฒŒ ํ•ด์ฃผ๊ณ  ๋‹ค๋ฅธ ์†์„ฑ์€ ๊ณตํ†ต ๋ถ„๋ชจ๋กœ ์–ด๋–ป๊ฒŒ ๋ฌถ์–ด์ค„ ์ˆ˜ ์žˆ๋Š”๊ฐ€? ์˜€๋Š”๋ฐ ์ด์— ๋Œ€ํ•œ ํ•ด๋‹ต์€ ๊ทธ๋ฆฌ ์–ด๋ ต์ง€ ์•Š์•˜๋‹ค.

 

SCSS MIXIN

https://sass-lang.com/documentation/at-rules/mixin

 

Sass: @mixin and @include

Mixins allow you to define styles that can be re-used throughout your stylesheet. They make it easy to avoid using non-semantic classes like .float-left, and to distribute collections of styles in libraries. Mixins are defined using the @mixin at-rule, whi

sass-lang.com

They can be used to encapsulate styles that can be dropped into a single style rule; they can contain style rules of their own that can be nested in other rules or included at the top level of the stylesheet; or they can just serve to modify variables.

 

SCSS MIXIN ์†์„ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฝ”๋“œ ๋‚ด์—์„œ ๊ณตํ†ต์œผ๋กœ ์“ฐ์ด๋Š” Style ์†์„ฑ์„ ์ •์˜ํ•˜๊ณ  Include ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•ด๋‹น ๊ฐ’์„ ๋ถˆ๋Ÿฌ์™€์„œ ์“ฐ๊ธฐ๋กœ ํ•˜์˜€๋‹ค.

 

๋™์ ์œผ๋กœ ๋ณ€ํ•˜๋Š” width๊ฐ’๊ณผ height๊ฐ’์„ ์ธ์ž๋กœ ์„ค์ •ํ•ด์ค€ ๋’ค์— 

@mixin moviePosterMix($width: 0, $height: 0) {
  width: $width;
  height: $height;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

ํ•ด๋‹น ํ•จ์ˆ˜๋ฅผ Include ๊ตฌ๋ฌธ์„ ํ†ตํ•ด ์ธ์ž๊ฐ’์„ ๋„ฃ์–ด ํ˜ธ์ถœํ•˜๋„๋ก ์ฝ”๋“œ๋ฅผ ๋ฐ”๊พธ์—ˆ๋”๋‹ˆ ์ข€ ๋” ๋ช…ํ™•ํ•ด์ง€๊ณ  ๊ฐ„๊ฒฐํ•ด ์กŒ๋‹ค.

.moviePosterQuarter {
      @include moviePosterMix(95%, 95%);
}
    
	(...)
    
.moviePoster {
      @include moviePosterMix(100%, 84%);
}
๋Œ“๊ธ€
๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
TAG
more
ยซ   2024/10   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
๊ธ€ ๋ณด๊ด€ํ•จ