/
Necoray
/
tactic-hack
Обзор
Документация
Войти
/
Necoray
/
tactic-hack
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/shared/components/Label.jsx
50 строк
1 KB
Роман Тихонов
files uploaded
23 янв 2025, 23:23
23 янв 2025, 23:23
1031718
Код
Авторство
О чём код?
import { contrastColor, errorColor, paddingWidth } from "../shared"; function Label({ children, text, errorText, horizontalStyle, ...props }) { const baseTextStyle = {paddingLeft: paddingWidth} let textStyle = {...baseTextStyle, marginBottom: 0, fontSize: 16} let errorStyle = {...baseTextStyle, marginTop: 0, color:errorColor, fontSize: 17} let horizontalStyleProps = {} if (horizontalStyle) { horizontalStyleProps = {display: "flex", flexDirection: 'row-reverse', alignItems: 'center', justifyContent: 'flex-end', gap: 10 } textStyle.marginBottom = 0; textStyle.marginRight = 0 textStyle.paddingLeft = 0; errorStyle.display = 'none' } const textE = <span style={textStyle}>{text}</span> const errorTextE = <span style={errorStyle}>{errorText}</span> return ( <label style={{ color: contrastColor, display: "flex", flexWrap: 'nowrap', width: 'min-content', flexDirection: 'column', ...horizontalStyleProps }} {...props} > {textE} {children} {errorTextE} </label> ) } export default Label;