일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- hooks
- git
- github
- AI
- dev
- JavaScript
- This
- react
- es6
- CSS
- developerlife
- 최적화
- 함수
- ES6+
- API
- hatso
- gitCLI
- ES5+
- 변수
- learn next.js
- 햇소
- html5
- next.js
- 우아한테코톡
- object
- 선택자
- array
- JS
- DOM
- Python
- Today
- Total
목록styled-components (2)
codinghatso

theme.js import { createGlobalStyle } from "styled-components"; export const GlobalStyle = createGlobalStyle` @import url('https://fonts.googleapis.com/...'); body{ font-family: 'Dongle', sans-serif; ... } `; export const theme = { colors: { ... }, spacing: { ... }, }; 코드의 구조를 살펴보시면 GlobalStyle과 theme를 export 해서 적용시키고자 하는 파일에서 import 해서 사용하면 됩니다. styled-components 라이브러리를 사용해서 적용시키고자 한다면, 위 코드처럼 ..

Theme 정의하는 방법 테마 객체를 만들어 일관성 있는 디자인 시스템을 구축하는 방법입니다. 유지보수가 용이하며, 생산력을 높여줄 수 있는 방법입니다. // theme.js export const theme = { colors: { primary: '#3498db', secondary: '#2ecc71', text: '#333', background: '#ecf0f1', }, spacing: { small: '8px', medium: '16px', large: '24px', }, }; // App.js import React from 'react'; import { ThemeProvider } from 'styled-components'; import { theme } from './theme'; im..