Portal/rsconcept/frontend/src/dialogs/DlgInlineSynthesis/TabSchema.tsx
IRBorisov 6c3461977d
Some checks are pending
Frontend CI / build (18.x) (push) Waiting to run
Refactoring: UI elements naming convention
2024-06-26 19:47:05 +03:00

45 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import { useMemo } from 'react';
import PickSchema from '@/components/select/PickSchema';
import TextInput from '@/components/ui/TextInput';
import AnimateFade from '@/components/wrap/AnimateFade';
import { useLibrary } from '@/context/LibraryContext';
import { LibraryItemID } from '@/models/library';
interface TabSchemaProps {
selected?: LibraryItemID;
setSelected: (newValue: LibraryItemID) => void;
}
function TabSchema({ selected, setSelected }: TabSchemaProps) {
const library = useLibrary();
const selectedInfo = useMemo(() => library.items.find(item => item.id === selected), [selected, library.items]);
return (
<AnimateFade className='flex flex-col'>
<div className='flex items-center gap-6'>
<span className='select-none'>Выбрана</span>
<TextInput
id='dlg_selected_schema_title'
disabled
noBorder
className='w-full'
placeholder='Выберите из списка ниже'
value={selectedInfo?.title ?? ''}
dense
/>
</div>
<PickSchema
id='dlg_schema_picker' // prettier: split lines
rows={15}
value={selected}
onSelectValue={setSelected}
/>
</AnimateFade>
);
}
export default TabSchema;