/
alt3rmann
/
label-studio
Обзор
Документация
Войти
/
alt3rmann
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
web/libs/editor/src/common/Input/Input.jsx
29 строк
778 B
yyassi-heartex
chore: OPTIC-1154: biome linting tweaks (#6425)
22 окт 2024, 23:22
Не верифицирован
22 окт 2024, 23:22
7ed55c6
Код
Авторство
О чём код?
import { forwardRef, useMemo } from "react"; import { cn } from "../../utils/bem"; import Label from "../Label/Label"; import "./Input.scss"; const Input = forwardRef(({ label, className, required, labelProps, ghost, waiting, ...props }, ref) => { const rootClass = cn("input"); const classList = [rootClass.mod({ ghost }), className].join(" ").trim(); const input = useMemo(() => { return waiting ? ( <div className={rootClass.elem("spinner")} /> ) : ( <input {...props} ref={ref} className={classList} /> ); }, [props, ref, classList, waiting]); return label ? ( <Label {...(labelProps ?? {})} text={label} required={required}> {input} </Label> ) : ( input ); }); Input.displayName = "Input"; export default Input;