diff --git a/apps/web/api/ius/types.ts b/apps/web/api/ius/types.ts index c7420c0..2fc2d35 100644 --- a/apps/web/api/ius/types.ts +++ b/apps/web/api/ius/types.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export type MetaObject = { disabled: boolean; - fieldType: 'CHECKBOX' | 'DECIMAL' | 'INT' | 'STRING'; + fieldType: 'CHECKBOX' | 'DECIMAL' | 'INT' | 'STRING' | 'TEXTAREA'; label: string; max: number; min: number; diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 73df465..24d41be 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -18,3 +18,24 @@ body { background-color: var(--color-background); } + +/* Scroll bar stylings */ +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +/* Track */ +::-webkit-scrollbar-track { +} + +/* Handle */ +::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.3); + border-radius: 2px; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: rgba(0, 0, 0, 0.4); +} diff --git a/apps/web/components/Form/Elements.tsx b/apps/web/components/Form/Elements.tsx index 4bc8010..c886051 100644 --- a/apps/web/components/Form/Elements.tsx +++ b/apps/web/components/Form/Elements.tsx @@ -4,6 +4,13 @@ import { useFormStore } from '@/store/ius/form'; import { useEffect } from 'react'; import { ElementContainer } from 'ui'; +function compatMetadata(metaData: Props['metaData']) { + const { comment, ...meta } = metaData; + comment.fieldType = 'TEXTAREA'; + + return { ...meta, comment }; +} + export function Elements({ data, metaData }: Props) { const { init, setValue, validation, values } = useFormStore(); @@ -13,7 +20,7 @@ export function Elements({ data, metaData }: Props) { return (
- {Object.keys(metaData).map((name) => { + {Object.keys(compatMetadata(metaData)).map((name) => { const { fieldType, label, max, min = 0, visible, ...props } = metaData[name]; if (!visible) return false; @@ -22,6 +29,7 @@ export function Elements({ data, metaData }: Props) { return ( >(arg: T) { return arg; @@ -10,4 +10,5 @@ export const mapFieldTypeElement = wrapMap({ DECIMAL: InputNumber, INT: InputNumber, STRING: Input, + TEXTAREA: Textarea, }); diff --git a/packages/ui/container.tsx b/packages/ui/container.tsx index d3ee7d5..f2308e0 100644 --- a/packages/ui/container.tsx +++ b/packages/ui/container.tsx @@ -5,7 +5,9 @@ import { forwardRef, type HTMLAttributes, type PropsWithChildren } from 'react'; export type ContainerProps = HTMLAttributes & PropsWithChildren; -const variants = cva('flex h-9 items-center', { +const parentVariants = cva('flex flex-col justify-center'); + +const variants = cva('min-h-[36px] flex items-center', { defaultVariants: { intent: 'default', }, @@ -18,11 +20,28 @@ const variants = cva('flex h-9 items-center', { }); export type WrapperProps = HTMLAttributes & - VariantProps & { readonly message?: string }; + VariantProps & { readonly classNameParent?: string; readonly message?: string }; export const ElementContainer = forwardRef( - ({ children, className, id, intent, message = 'Некорректные данные', title, ...props }, ref) => ( -
+ ( + { + children, + className, + classNameParent, + id, + intent, + message = 'Некорректные данные', + title, + ...props + }, + ref + ) => ( +