/
outthevoid
/
frontend_developer_module_5
Обзор
Документация
Войти
/
outthevoid
/
frontend_developer_module_5
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/components/ui/title/style.js
27 строк
499 B
darthmorgot
Добавил переменную для подстановки стилей в зависимости от размера заголовка, и применил её в коде.
03 фев 2024, 12:21
03 фев 2024, 12:21
fca264d
Код
Авторство
О чём код?
import styled, {css} from 'styled-components'; const TitleStyleValue = { big: { fontSize: '44px', lineHeight: '115%' }, medium: { fontSize: '24px', lineHeight: '130%' }, small: { fontSize: '18px', lineHeight: '150%' } }; export const StyledTitle = styled.h1` margin: 0; font-weight: 700; ${props => { return css` font-size: ${TitleStyleValue[props.$size].fontSize}; line-height: ${TitleStyleValue[props.$size].lineHeight}; `; }}; `;