/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/containers/Tenant/TableFormDialog/components/layout.tsx
96 строк
2 KB
Максим
feat: add topic and table forms (#3909)
28 июл 2026, 12:49
Не верифицирован
28 июл 2026, 12:49
7477f07
Код
Авторство
О чём код?
import React from 'react'; import {HelpMark, Text} from '@gravity-ui/uikit'; import {cn} from '../../../../utils/cn'; const b = cn('ydb-table-form-dialog'); export function FormSection({ title, note, children, }: { title?: string; note?: string; children: React.ReactNode; }) { return ( <section className={b('section')}> {title ? ( <Text as="div" variant="subheader-2" className={b('section-title')}> {title} {note ? ( <HelpMark className={b('help-mark')} popoverProps={{ placement: ['bottom', 'right'], className: b('help-mark-popup'), }} > {note} </HelpMark> ) : null} </Text> ) : null} {children} </section> ); } export function FormRow({ title, note, htmlFor, children, }: { title?: string; note?: string; htmlFor?: string; children: React.ReactNode; }) { let labelTitleNode: React.ReactNode = null; if (title) { if (htmlFor) { labelTitleNode = ( <label className={b('label-title')} htmlFor={htmlFor}> {title} </label> ); } else { labelTitleNode = <span className={b('label-title')}>{title}</span>; } } return ( <div className={b('row')}> <div className={b('label')}> {labelTitleNode} {note ? ( <HelpMark className={b('help-mark')} popoverProps={{ placement: ['bottom', 'right'], className: b('help-mark-popup'), }} > {note} </HelpMark> ) : null} </div> <div className={b('row-control')}>{children}</div> </div> ); } export function FormFieldError({message}: {message?: string}) { if (!message) { return null; } return ( <Text color="danger" variant="body-1" className={b('field-error')}> {message} </Text> ); }