Young Bae, young.gratia@navercorp.com
NAVER Place Service Dev 2
Before we start, Why bother?
Old-fashined way | Brand-new way | |
---|---|---|
Dev Scope | Page π | Component π± |
CSS Tools | Sass (+ style-loader, css-loader, etc) | CSS-in-JS π |
CSS Style Conflict Possibility | I hope not! π«Β | What is it? π€ |
Finger Fatigue βοΈ | High | Low |
https://css-tricks.com/methods-organize-css/
Use prop, or CSS class as Modifier.
Atoms can also include more abstract elements like color palettes, fonts and even more invisible aspects of an interface like animations.
http://bradfrost.com/blog/post/atomic-web-design/#atoms
static class
dynamic class
export const Z_INDEX = Object.freeze({
alertDialog: 500,
address: {
dialog: 100,
form: 100,
},
bizphoneSelector: 10,
dimmed: 1000,
floatingButton: 500,
drawer: 1000,
drawerHeader: 10,
gnb: 1000,
modal: 10000,
modalStickyHeader: 100,
opening: 1100,
openingFormBorder: 1,
thumbButton: 10,
})
const Color = {
background: '#e8edf0',
backgroundLight: '#f4f7f8',
backgroundFooter: '#f4f6f7',
backgroundGray: '#fafbfc',
backgroundLightGray: '#f5f9ff',
black: '#000',
blackTransparent: alpha => `rgba(0,0,0,${alpha})`,
blue: '#14a0fa',
blueDark: '#0068c3',
blueLight: '#7abeea',
border: '#d9dadb',
borderLight: '#ecf0f2',
borderOuter: '#e2e5e8',
borderSkyblue: '#90d4ff',
green: '#00c73c',
greenDark: '#0abe16',
mainText: '#424242',
navy: '#0068c3',
red: '#ff3c4c',
redLight: '#ffe0e1',
subText: '#8f8f8f',
subTextLight: '#a9a9a9',
title: '#242424',
white: '#fff',
disabled: '#ccc',
}
export default Color
import { createGlobalStyle } from 'styled-components'
import Font from 'assets/Font'
import Color from 'elements/Color'
// Thigns to include:
// - font-face rule
// - reset CSS
// - util classes, etc.
const GlobalStyle = createGlobalStyle`
@font-face {
font-weight: 300;
font-family: 'NanumSquare';
src: url(${Font.nanumSquareLight}) format("truetype");
}
@font-face {
font-weight: 400;
font-family: 'NanumSquare';
src: url(${Font.nanumSquareRegular}) format("truetype");
}
// ...
Where should we put those components?
src/
βββ assets/
β βββ Font/
β βββ GlobalStyle/
β βββ Icon/
β βββ Image/
βββ blocks/
β βββ Accordion/
β βββ AgreementList/
β βββ AlertDialog/
β βββ BizCard/
β βββ ...
βββ containers/
β βββ Businesses
β βββ Footer
β βββ Gnb
β βββ ...
βββ elements/
β βββ Button/
β βββ Checkbox/
β βββ ...
βββ modals/
β βββ BizDelegation/
β βββ BizDelete/
β βββ ...
βββ ...
πΆπΆ
π¦π¦
π§π§
...
import styled from 'styled-components'
import Color from 'elements/Color'
const Hr = styled.hr`
margin: 0;
border-top: 1px solid ${Color.borderOuter};
border-bottom: 1px solid ${Color.borderOuter};
height: 9px;
background-color: ${Color.background};
`
export default Hr
STORYBOOK