Portal/rsconcept/frontend/src/features/help/pages/manuals-page/topics-static.tsx

41 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-08-05 20:01:18 +03:00
'use client';
2024-06-07 20:17:03 +03:00
import clsx from 'clsx';
2025-03-12 12:04:23 +03:00
import { SelectTree } from '@/components/input';
2025-03-12 11:54:32 +03:00
import { useFitHeight } from '@/stores/app-layout';
2024-06-07 20:17:03 +03:00
import { prefixes } from '@/utils/constants';
2025-02-11 20:56:11 +03:00
import { describeHelpTopic, labelHelpTopic } from '../../labels';
2025-03-12 11:54:32 +03:00
import { HelpTopic, topicParent } from '../../models/help-topic';
2024-06-07 20:17:03 +03:00
interface TopicsStaticProps {
activeTopic: HelpTopic;
onChangeTopic: (newTopic: HelpTopic) => void;
}
2025-02-19 23:29:45 +03:00
export function TopicsStatic({ activeTopic, onChangeTopic }: TopicsStaticProps) {
const topicsHeight = useFitHeight('1rem + 2px');
2024-06-07 20:17:03 +03:00
return (
<SelectTree
items={Object.values(HelpTopic).map(item => item as HelpTopic)}
value={activeTopic}
onChange={onChangeTopic}
2024-06-07 20:17:03 +03:00
prefix={prefixes.topic_list}
getParent={item => topicParent.get(item) ?? item}
getLabel={labelHelpTopic}
getDescription={describeHelpTopic}
className={clsx(
'sticky top-0 left-0',
2025-09-10 22:04:57 +03:00
'min-w-60 max-w-60',
2024-06-07 20:17:03 +03:00
'cc-scroll-y',
'self-start',
2024-12-11 23:37:23 +03:00
'border-x border-t rounded-none',
2025-04-17 14:37:47 +03:00
'text-xs sm:text-sm bg-secondary',
2024-06-07 20:17:03 +03:00
'select-none'
)}
style={{ maxHeight: topicsHeight }}
2024-06-07 20:17:03 +03:00
/>
);
}