From 074c66e8a79b0a4afa750de82c607afe6083e5ad Mon Sep 17 00:00:00 2001 From: milliwonkim Date: Thu, 22 Jun 2023 16:17:20 +0900 Subject: [PATCH 01/10] =?UTF-8?q?docs:=20=EC=B4=88=EC=95=88=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../04-styling/01-css-modules.mdx | 114 ++++++++++-------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/docs/02-app/01-building-your-application/04-styling/01-css-modules.mdx b/docs/02-app/01-building-your-application/04-styling/01-css-modules.mdx index 41063ff08..dbf15c0c4 100644 --- a/docs/02-app/01-building-your-application/04-styling/01-css-modules.mdx +++ b/docs/02-app/01-building-your-application/04-styling/01-css-modules.mdx @@ -1,27 +1,29 @@ --- -title: CSS Modules -description: Style your Next.js Application with CSS Modules. +title: CSS 모듈 +description: CSS 모듈로 Next.js 앱에 스타일 적용하기 ---
- Examples + 예시 -- [Basic CSS Example](https://github.com/vercel/next.js/tree/canary/examples/basic-css) +- [기본 CSS 예시](https://github.com/vercel/next.js/tree/canary/examples/basic-css)
-Next.js has built-in support for CSS Modules using the `.module.css` extension. +Next.js는 `.module.css` 확장자를 사용하여 CSS 모듈을 기본적으로 지원합니다. -CSS Modules locally scope CSS by automatically creating a unique class name. This allows you to use the same class name in different files without worrying about collisions. This behavior makes CSS Modules the ideal way to include component-level CSS. +CSS 모듈은 고유한 클래스 이름을 자동으로 생성해서 CSS를 로컬로 범위를 지정합니다. +따라서 충돌에 대한 걱정 없이 다른 파일에서 동일한 클래스 이름을 사용 가능합니다. +이 방식으로 CSS 모듈을 컴포넌트 단위로 CSS를 적용할 수 있습니다. -## Example +## 예시 -CSS Modules can be imported into any file inside the `app` directory: +CSS 모듈은 app 폴더 안에서 어떤 파일이든 임포트할 수 있습니다. ```tsx filename="app/dashboard/layout.tsx" switcher import styles from './styles.module.css' @@ -57,14 +59,12 @@ export default function DashboardLayout({ -For example, consider a reusable `Button` component in the `components/` folder: - -First, create `components/Button.module.css` with the following content: +components 폴더 안의 재사용 가능한 Button 컴포넌트로 예를 들어봅시다. +먼저, 다음의 코드를 `components/Button.module.css` 파일 안에 만듭니다. ```css filename="Button.module.css" /* -You do not need to worry about .error {} colliding with any other `.css` or -`.module.css` files! +다른 .css 혹은 .module.css 파일과 충돌하는 .error {} 대해서 고려할 필요는 없습니다. */ .error { color: white; @@ -72,7 +72,7 @@ You do not need to worry about .error {} colliding with any other `.css` or } ``` -Then, create `components/Button.js`, importing and using the above CSS file: +그리고, `components/Button.js` 파일을 만들고, 다음의 CSS 파일을 자바스크립트 파일에 임포트합니다. ```jsx filename="components/Button.js" import styles from './Button.module.css' @@ -81,8 +81,7 @@ export function Button() { return (