Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout/#31 #32

Merged
merged 9 commits into from
Feb 23, 2024
Merged

layout/#31 #32

merged 9 commits into from
Feb 23, 2024

Conversation

yougyung
Copy link
Member

@yougyung yougyung commented Feb 21, 2024

๐Ÿ“Œ ์ž‘์—… ๋‚ด์šฉ

๊ตฌํ˜„ ๋‚ด์šฉ ๋ฐ ์ž‘์—… ํ–ˆ๋˜ ๋‚ด์—ญ

  • ๊ณตํ†ต layout ๊ตฌํ˜„
  • ๊ณตํ†ต template ๊ตฌํ˜„

๐Ÿค” ๊ณ ๋ฏผ ํ–ˆ๋˜ ๋ถ€๋ถ„

  • ํŽ˜์ด์ง€์—์„œ ๊ณตํ†ต์œผ๋กœ ๋ถ„๋ฅ˜ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฒ”์ฃผ๊ฐ€

    1. ๋ฐฐ๊ฒฝ๊ณผ ์ „์—ญ์—์„œ ์‚ฌ์šฉ๋˜๋Š” navigationBar -> layout
    2. content๋ฅผ ๋‹ด๋‹นํ•˜๋Š” 2๊ฐ€์ง€ ํฌ๊ธฐ์˜ Box -> template

    ๋ผ๊ณ  ์ƒ๊ฐํ•ด์„œ layout๊ณผ template์„ ๊ตฌ๋ถ„ํ•˜์˜€์œผ๋ฉฐ, ์ตœ์ƒ๋‹จ์— layout์„ ๋ฐฐ์น˜ํ–ˆ๊ณ  template์˜ ๊ฒฝ์šฐ์—๋Š” page์— ์˜์กด์„ฑ์„ ๊ฐ–๋Š”๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ page์—์„œ ํ˜ธ์ถœํ•˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • template์— style์ด ์•„๋‹Œ className๋กœ ์†์„ฑ์˜ ๋„ค์ด๋ฐ์„ ๋ถ™์ธ ์ด์œ ๋Š”

    1. template์ปดํฌ๋„ŒํŠธ๊ฐ€ page์— ์˜์กดํ•˜๋˜
    2. layout์œผ๋กœ์„œ ์ž‘์šฉํ•˜๊ธธ ํฌ๋งํ–ˆ์Šต๋‹ˆ๋‹ค.

    template์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฐ ์‚ฌ์šฉ์ฒ˜์—์„œ html์ฒ˜๋Ÿผ ์‚ฌ์šฉ๋˜๊ธธ ํฌ๋งํ•ด์„œ className์†์„ฑ๋ช…์„ ์ง€์ •ํ•˜์˜€์œผ๋ฉฐ, ๋‹ค๋ฅธ html ํƒœ๊ทธ์™€์˜ ์‚ฌ์ด์—์„œ ํ†ต์ผ์„ฑ์„ ๊ฐ–์ถœ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ถ€๋ถ„์€ ํŒ€์›๋“ค์˜ ์˜๊ฒฌ์ด ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

  • template์˜ children type์œผ๋กœ React.ReactNode type์„ ๋ฐ›๋Š” ๊ฒƒ์ด ๋งž์„๊นŒ ๊ณ ๋ฏผํ–ˆ๋Š”๋ฐ, <template>์„ <div>์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๊ธธ ํฌ๋งํ•ด์„œ ์—ฌ๋Ÿฌ element๋ฅผ children์œผ๋กœ ํ—ˆ์šฉํ•  ์ˆ˜ ์žˆ๋Š”React.ReactNode๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ”Š ๋„์›€์ด ํ•„์š”ํ•œ ๋ถ€๋ถ„

์ดˆ๊ธฐ

  • ์ตœ์ƒ๋‹จ์— ๋ฐฐ์น˜ํ•œ layout์˜ ๊ฒฝ์šฐ mainํŽ˜์ด์ง€ ์—ฌ๋ถ€๋ฅผ ์‹๋ณ„ํ•œ ์ดํ›„, ๋ ˆ์ด์•„์›ƒ์ด ์ ์šฉ๋˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • main page ์‹๋ณ„ ๋‹จ๊ณ„์—์„œ import { usePathname } from 'next/navigation'; ์„ ์‚ฌ์šฉํ•ด์•ผ ํ–ˆ๋Š”๋ฐ, ์ตœ์ƒ๋‹จ์— 'use client';๋ฅผ ์„ ์–ธํ•ด์•ผํ•œ๋‹ค๋Š” ๋ฌธ์ œ๋ฅผ ๊ฒช์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์„ ํ†ตํ•ด ์‹๋ณ„ํ•  ์ˆ˜ ์žˆ์„์ง€, ๊ณ ๊ฒฌ์„ ๋‚จ๊ฒจ์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์ˆ˜์ •

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-02-21 แ„‹แ…ฉแ„’แ…ฎ 6 00 32
  • ๊ฐ€ํ˜„์ด๊ฐ€ ์ค€ ์˜๊ฒฌ์œผ๋กœ ๊ณ„์ธต์„ ํ•˜๋‚˜ ๋” ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ˆ˜์ •ํ•ด๋ดค์Šต๋‹ˆ๋‹ค.
  1. appํ•˜์œ„์— ํฌํ•จ๋œ layout์—๋Š” ์„œ๋น„์Šค ์ „์ฒด์— ๊ณตํ†ต์œผ๋กœ ๋“ค์–ด๊ฐ€๋Š” GNB
  2. ๋ฉ”์ธํŽ˜์ด์ง€๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ํŽ˜์ด์ง€์— ๋Œ€ํ•ด์„œ๋Š” ์ƒ์„ฑํ•œ (template)ํด๋”์— ๋ฐฐ์น˜์‹œํ‚ค๋ฉฐ, (template)ํด๋” ํ•˜์œ„์˜ layout์— background๋ฅผ ํฌํ•จํ•˜์˜€์Šต๋‹ˆ๋‹ค.

@yougyung yougyung linked an issue Feb 21, 2024 that may be closed by this pull request
@yougyung yougyung self-assigned this Feb 21, 2024
Copy link

Copy link

Copy link

Copy link
Collaborator

@seonghunYang seonghunYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค. ์งˆ๋ฌธ ๋‚จ๊ฒจ์š”
  • ๊ณ ๋ฏผํ–ˆ๋˜ ๋ถ€๋ถ„์— "template์— style์ด ์•„๋‹Œ className๋กœ ์†์„ฑ"์— ๋Œ€ํ•ด์„œ ์ข€ ๋” ์„ค๋ช…ํ•ด์ฃผ์‹œ๊ฒ ์–ด์š”?
  • template children์œผ๋กœ React.ReactNode๋Š” ์ ์ ˆํ•ด๋ณด์ž…๋‹ˆ๋‹ค

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[comment]

  • template ํŒŒ์ผ์ด ์ด ์œ„์น˜์— ์žˆ์–ด๋„ ์ ์šฉ์ด ๋˜๋‚˜์š”?
  • ์•„๋‹ˆ๋ฉด next๊ฐ€ ์ •์˜ํ•œ template์™€ ๋ณ„๊ฐœ์˜ template ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  ์‹ถ์—ˆ๋˜ ๊ฑด๊ฐ€์š”?

https://nextjs.org/docs/getting-started/project-structure#routing-files

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content๋ฅผ ๋‹ด๋Š” box๋ฅผ ๋ณ„๊ฐœ์˜ ์ปดํฌ๋„ŒํŠธ๋กœ ์ƒ์„ฑํ•˜๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค.
๋‹ค๋งŒ, ๋„ค์ด๋ฐ์ด ์ ์ ˆํ•˜์ง€ ์•Š์€ ๊ฒƒ ๊ฐ™์•„์„œ ์ด๋ถ€๋ถ„์€ ContentContainer๋กœ ๋ณ€๊ฒฝํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

return (
<>
<Image
src="/assets/background.png"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[request change]

  • local ์ด๋ฏธ์ง€๋‹ˆ๊นŒ next์˜ ์ปจ๋ฒค์…˜์„ ๋”ฐ๋ฅด๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š”?
  • src์— string๋ณด๋‹ค ์ด๋ฏธ์ง€๋ฅผ importํ•˜๊ณ  ๋„ฃ์–ด์ฃผ๋ฉด ์›๊ฒฉ ์ด๋ฏธ์ง€์™€ ๊ตฌ๋ถ„์ด ๋ช…ํ™•ํ•ด์งˆ ๊ฒƒ ๊ฐ™์•„์š”!
import Image from 'next/image'
import profilePic from './me.png'
 
export default function Page() {
  return (
    <Image
      src={profilePic}
      alt="Picture of the author"
      // width={500} automatically provided
      // height={500} automatically provided
      // blurDataURL="data:..." automatically provided
      // placeholder="blur" // Optional blur-up while loading
    />
  )
}

// ์ฐธ๊ณ 
https://nextjs.org/docs/app/building-your-application/optimizing/images#local-images

className?: string;
}

export default function Template({ children, size = 'md', className }: TemplateProps) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template๋ณด๋‹ค content layout์ด๋ผ๋Š” ์ด๋ฆ„์ด ๋” ์ ํ•ฉํ•˜์ง€ ์•Š์„๊นŒ์š”!? ๋˜ํ•œ atom ํด๋”์— ์žˆ๋Š” ๊ฒŒ ์ ํ•ฉํ•  ์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layout๋ณด๋‹ค๋Š” container์— ๊ฐ€๊น๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ค์–ด์„œ ContentContainer ํ•ด๋‹น ๋„ค์ด๋ฐ์œผ๋กœ ์ง„ํ–‰์„ ๊ณ„ํšํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค !
'๋” ์ด์ƒ ์ชผ๊ฐค ์ˆ˜ ์—†๋Š” ๋””์ž์ธ์˜ ์ตœ์†Œ ๋‹จ์œ„'๊ฐ€ ์šฐ๋ฆฌ๊ฐ€ ์ •์˜ํ•œ atom์˜ ๊ธฐ์ค€์ด์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น ํด๋”์— ๋ถ„๋ฅ˜ํ•˜๋Š” ๊ฒƒ๋„ ๋ฌธ์ œ๊ฐ€ ๋˜์ง€ ์•Š๋Š”๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ํ˜น์‹œ ์ƒ๊ฐํ•˜์‹œ๋Š” ๋” ์ ํ•ฉํ•œ ๋ถ„๋ฅ˜๊ฐ€ ์žˆ๋‹ค๋ฉด, ์˜๊ฒฌ์„ ๋“ฃ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ๋ณด๋‹ค layout ๊ฐœ๋…์— ๋” ๊ฐ€๊น์ง€ ์•Š์„๊นŒ ์ƒ๊ฐ์„ ํ–ˆ์—ˆ๋Š”๋ฐ ์ €ํฌ๊ฐ€ ์ •์˜ํ•œ atom ๋‹จ์œ„๊ฐ€ ๋” ์ด์ƒ ์ชผ๊ฐค ์ˆ˜ ์—†๋Š” ๋””์ž์ธ์˜ ์ตœ์†Œ ๋‹จ์œ„๋ผ๋ฉด ํฌ๊ฒŒ ์ƒ๊ด€ ์—†์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค~!

return (
<div
className={twMerge(
'absolute bg-white top-[7rem] z-10 rounded-xl p-[1.5rem] shadow-lg max-md:w-full',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

z-index๊ฐ€ ๋ฌด๋ถ„๋ณ„ํ•˜๊ฒŒ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋Š” ๊ฑธ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์ €๋Š” ์ข€ ์ •๋ฆฌํ•˜๋Š” ํŽธ์ธ๋ฐ tailwind config์— ์ด๋ ‡๊ฒŒ ์ •๋ฆฌํ•ด๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”~!

zIndex: {
      0: '1',
      1: '100', // Input
      2: '200', // Fixed bottom Bar, Sidebar, Tooltip
      3: '300', // Bottom bar, Top bar Backdrop
       ....
    },

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์€ ๋ฐฉ์‹์ธ ๊ฒƒ ๊ฐ™์•„์š” ์ ์šฉํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค ๐Ÿ‘

@yougyung
Copy link
Member Author

yougyung commented Feb 21, 2024

  • ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค. ์งˆ๋ฌธ ๋‚จ๊ฒจ์š”
  • ๊ณ ๋ฏผํ–ˆ๋˜ ๋ถ€๋ถ„์— "template์— style์ด ์•„๋‹Œ className๋กœ ์†์„ฑ"์— ๋Œ€ํ•ด์„œ ์ข€ ๋” ์„ค๋ช…ํ•ด์ฃผ์‹œ๊ฒ ์–ด์š”?
  • template children์œผ๋กœ React.ReactNode๋Š” ์ ์ ˆํ•ด๋ณด์ž…๋‹ˆ๋‹ค

template์„ component๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ–ˆ๊ณ  component์˜ style์„ ๋‹ด๋‹นํ•˜๋Š” prop์˜ ์†์„ฑ๋ช…์„ style๋กœ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ htmlํƒœ๊ทธ์˜ ๊ฒฝ์šฐ์—๋Š” className์œผ๋กœ ์Šคํƒ€์ผ ์†์„ฑ์„ ์ง€์ •ํ•˜๋“ฏ์ด, ํ•ด๋‹น component๋„ style์„ ๋‹ด๋‹นํ•˜์ง€๋งŒ htmlํƒœ๊ทธ์ฒ˜๋Ÿผ ์‚ฌ์šฉ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ๋‹ค๋Š” ์˜๋„๋ฅผ ๊ฐ–๊ณ 

  1. ์ปดํฌ๋„ŒํŠธ ๋„ค์ด๋ฐ์œผ๋กœ ์ผ๋ฐ˜์ ์ธ ์˜๋ฏธ๋ฅผ ๊ฐ–๋Š” template
  2. style์ง€์ • ์†์„ฑ ๋ช…์„ className์œผ๋กœ ์ง€์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค

๋‹ค๋งŒ ๋‚จ๊ฒจ์ฃผ์‹  ์˜๊ฒฌ์„ ํ† ๋Œ€๋กœ ์ปดํฌ๋„ŒํŠธ์˜ ๋„ค์ด๋ฐ์„ template ๊ทธ๋Œ€๋กœ ๊ฐ€์ ธ๊ฐ€๋Š” ๊ฒƒ์€ Next์˜ template๊ณผ์˜ ์‚ฌ์ด์—์„œ ํ˜ผ๋ž€์ด ์žˆ์„ ๊ฒƒ ๊ฐ™์•„ ContentContainer์œผ๋กœ์˜ ๋ณ€๊ฒฝ์„ ์˜ˆ์ •ํ•˜๊ณ  ์žˆ์œผ๋ฉฐ, ์ปดํฌ๋„ŒํŠธ ๋„ค์ด๋ฐ์ด ๋ณ€๊ฒฝ๋จ์— ๋”ฐ๋ผ์„œ style ์ง€์ • ์†์„ฑ ๋ช…๋„ ๊ธฐ์กด className์—์„œ style๋กœ ๋ณ€๊ฒฝํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

gahyuun
gahyuun previously approved these changes Feb 22, 2024
Copy link

Copy link

gahyuun
gahyuun previously approved these changes Feb 22, 2024
@seonghunYang
Copy link
Collaborator

  • ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค. ์งˆ๋ฌธ ๋‚จ๊ฒจ์š”
  • ๊ณ ๋ฏผํ–ˆ๋˜ ๋ถ€๋ถ„์— "template์— style์ด ์•„๋‹Œ className๋กœ ์†์„ฑ"์— ๋Œ€ํ•ด์„œ ์ข€ ๋” ์„ค๋ช…ํ•ด์ฃผ์‹œ๊ฒ ์–ด์š”?
  • template children์œผ๋กœ React.ReactNode๋Š” ์ ์ ˆํ•ด๋ณด์ž…๋‹ˆ๋‹ค

template์„ component๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ–ˆ๊ณ  component์˜ style์„ ๋‹ด๋‹นํ•˜๋Š” prop์˜ ์†์„ฑ๋ช…์„ style๋กœ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ htmlํƒœ๊ทธ์˜ ๊ฒฝ์šฐ์—๋Š” className์œผ๋กœ ์Šคํƒ€์ผ ์†์„ฑ์„ ์ง€์ •ํ•˜๋“ฏ์ด, ํ•ด๋‹น component๋„ style์„ ๋‹ด๋‹นํ•˜์ง€๋งŒ htmlํƒœ๊ทธ์ฒ˜๋Ÿผ ์‚ฌ์šฉ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ๋‹ค๋Š” ์˜๋„๋ฅผ ๊ฐ–๊ณ 

  1. ์ปดํฌ๋„ŒํŠธ ๋„ค์ด๋ฐ์œผ๋กœ ์ผ๋ฐ˜์ ์ธ ์˜๋ฏธ๋ฅผ ๊ฐ–๋Š” template
  2. style์ง€์ • ์†์„ฑ ๋ช…์„ className์œผ๋กœ ์ง€์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค

๋‹ค๋งŒ ๋‚จ๊ฒจ์ฃผ์‹  ์˜๊ฒฌ์„ ํ† ๋Œ€๋กœ ์ปดํฌ๋„ŒํŠธ์˜ ๋„ค์ด๋ฐ์„ template ๊ทธ๋Œ€๋กœ ๊ฐ€์ ธ๊ฐ€๋Š” ๊ฒƒ์€ Next์˜ template๊ณผ์˜ ์‚ฌ์ด์—์„œ ํ˜ผ๋ž€์ด ์žˆ์„ ๊ฒƒ ๊ฐ™์•„ ContentContainer์œผ๋กœ์˜ ๋ณ€๊ฒฝ์„ ์˜ˆ์ •ํ•˜๊ณ  ์žˆ์œผ๋ฉฐ, ์ปดํฌ๋„ŒํŠธ ๋„ค์ด๋ฐ์ด ๋ณ€๊ฒฝ๋จ์— ๋”ฐ๋ผ์„œ style ์ง€์ • ์†์„ฑ ๋ช…๋„ ๊ธฐ์กด className์—์„œ style๋กœ ๋ณ€๊ฒฝํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

  • ์ดํ•ดํ–ˆ์Šต๋‹ˆ๋‹ค. ์„ค๋ช… ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.
  • ๊ทธ๋Ÿฐ๋ฐ className ์†์„ฑ์ด ๋‹ค์‹œ style๋กœ ๋ณ€๊ฒฝ๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ด์— ๋Œ€ํ•œ ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”? ์ €๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ 2๊ฐ€์ง€ ์ด์œ ๋กœ className์ด ๋” ์ ์ ˆํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.
    • tailwind๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, ๊ฐœ๋ฐœ์ž๊ฐ€ ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ๋ฅผ ํ™•์žฅํ•  ๋•Œ className์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ์Šต๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ํ˜ผ๋™๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • style ์†์„ฑ์€ HTML์— ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‚ด์žฅ๋˜์–ด ์žˆ์–ด, ํ˜ผ๋™๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋งŒ์•ฝ ํ•ฉ๋ฆฌ์ ์ธ ์ด์œ ๊ฐ€ ์žˆ๋‹ค๋ฉด, ์ปดํฌ๋„ŒํŠธ๊ฐ€ tw-merge๋ฅผ ํ†ตํ•ด ํ™•์žฅ๋  ๋•Œ ์†์„ฑ ์ด๋ฆ„์„ style๋กœ ํ†ต์ผํ•˜๋Š” ๊ฒƒ์„ ์ปจ๋ฒค์…˜์œผ๋กœ ์ •ํ•ด์•ผ ํ†ต์ผ์„ฑ์„ ํ™•๋ณดํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

@yougyung
Copy link
Member Author

  • ์ดํ•ดํ–ˆ์Šต๋‹ˆ๋‹ค. ์„ค๋ช… ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

  • ๊ทธ๋Ÿฐ๋ฐ className ์†์„ฑ์ด ๋‹ค์‹œ style๋กœ ๋ณ€๊ฒฝ๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ด์— ๋Œ€ํ•œ ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”? ์ €๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ 2๊ฐ€์ง€ ์ด์œ ๋กœ className์ด ๋” ์ ์ ˆํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

    • tailwind๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, ๊ฐœ๋ฐœ์ž๊ฐ€ ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ๋ฅผ ํ™•์žฅํ•  ๋•Œ className์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ์Šต๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ํ˜ผ๋™๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • style ์†์„ฑ์€ HTML์— ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‚ด์žฅ๋˜์–ด ์žˆ์–ด, ํ˜ผ๋™๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋งŒ์•ฝ ํ•ฉ๋ฆฌ์ ์ธ ์ด์œ ๊ฐ€ ์žˆ๋‹ค๋ฉด, ์ปดํฌ๋„ŒํŠธ๊ฐ€ tw-merge๋ฅผ ํ†ตํ•ด ํ™•์žฅ๋  ๋•Œ ์†์„ฑ ์ด๋ฆ„์„ style๋กœ ํ†ต์ผํ•˜๋Š” ๊ฒƒ์„ ์ปจ๋ฒค์…˜์œผ๋กœ ์ •ํ•ด์•ผ ํ†ต์ผ์„ฑ์„ ํ™•๋ณดํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์†์„ฑ ๋ช…๊ณผ ๊ด€๋ จํ•ด์„œ๋Š” ๊ณ ๋ฏผ์ด ์žˆ์—ˆ๋Š”๋ฐ,

  1. component์— ๋Œ€ํ•œ style ์†์„ฑ์„ props๋กœ ์ „๋‹ฌํ•œ๋‹ค๋Š” ์ฐจ์›์—์„œ className๊ณผ ๊ตฌ๋ณ„๋˜๋Š” ๋‹ค๋ฅธ ๋„ค์ด๋ฐ์„ ์‚ฌ์šฉํ•ด์•ผํ•˜์ง€ ์•Š์„๊นŒ?
  2. ์†์„ฑ๋ช…์„ className์œผ๋กœ ๊ฐ€์ ธ๊ฐ„๋‹ค๋ฉด html ํƒœ๊ทธ ์‚ฌ์ด์—์„œ ์ผ๊ด€์„ฑ์„ ํ™•๋ณดํ•  ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ?

๋‘ ๊ฐ€์ง€ ์˜๊ฒฌ ์ค‘์—์„œ ๊ณ ๋ฏผ์„ ํ•˜๋‹ค, ์ปดํฌ๋„ŒํŠธ์˜ style์„ ์ง€์ •ํ•˜๋Š” ์†์„ฑ์ด๋‹ˆ style๋„ค์ด๋ฐ์œผ๋กœ ๊ฐ€์ ธ๊ฐ€์ž
๋กœ ๊ฒฐ์ •ํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. (๋ง์”€ํ•ด์ฃผ์‹  ์˜๊ฒฌ์„ ํ†ตํ•ด style ์†์„ฑ์€ HTML์— ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‚ด์žฅ๋˜์–ด ์žˆ์œผ๋‹ˆ ์ ์ ˆํ•˜์ง€ ์•Š์•„, ํ•ด๋‹น ์˜๊ฒฌ์œผ๋กœ ์ง„ํ–‰ํ•˜๋”๋ผ๋„ ์†์„ฑ๋ช…์˜ ๋ณ€๊ฒฝ์„ ์ง„ํ–‰ํ•ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.)

์ €๋„ className์œผ๋กœ ์†์„ฑ๋ช…์„ ๊ฐ€์ ธ๊ฐ€๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ๋‹ค๋Š” ์˜๊ฒฌ์— ๊ณต๊ฐํ•ด์„œ, ๊ฐ€ํ˜„๋‹˜๊ป˜์„œ ๋‹ค๋ฅธ ์˜๊ฒฌ์ด ์—†์œผ์‹œ๋‹ค๋ฉด className์œผ๋กœ ์†์„ฑ๋ช… ๋ณ€๊ฒฝ์„ ์ง„ํ–‰ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค !

Copy link

Copy link
Collaborator

@seonghunYang seonghunYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค.
  • ๊ทธ๋Ÿฐ๋ฐ, ๋‹ค์Œ PR๋ถ€ํ„ฐ๋Š” ์œ ๊ฒฝ ์”จ๋„ ์Šคํ† ๋ฆฌ๋ถ์„ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹๊ฒ ๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“œ๋„ค์š”~~

Copy link
Member

@gahyuun gahyuun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค~!

@yougyung yougyung merged commit 02ee334 into main Feb 23, 2024
3 checks passed
@yougyung yougyung deleted the layout/#31 branch February 23, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout ์ƒ์„ฑ
3 participants