mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import clsx from 'clsx';
|
||
|
||
import { HelpTopic } from '@/models/miscelanious';
|
||
import { prefixes } from '@/utils/constants';
|
||
import { describeHelpTopic, labelHelpTopic } from '@/utils/labels';
|
||
|
||
interface TopicsListProps {
|
||
activeTopic: HelpTopic
|
||
onChangeTopic: (newTopic: HelpTopic) => void
|
||
}
|
||
|
||
function TopicsList({ activeTopic, onChangeTopic }: TopicsListProps) {
|
||
return (
|
||
<div className={clsx(
|
||
'sticky top-0 left-0',
|
||
'min-w-[13rem] h-fit',
|
||
'flex flex-col',
|
||
'border-x',
|
||
'clr-controls',
|
||
'small-caps',
|
||
'select-none'
|
||
)}>
|
||
<h1 className='mt-2 mb-1'>Справка</h1>
|
||
{Object.values(HelpTopic).map(
|
||
(topic, index) =>
|
||
<div key={`${prefixes.topic_list}${index}`}
|
||
className={clsx(
|
||
'px-3 py-1',
|
||
'border-y',
|
||
'clr-hover',
|
||
'cursor-pointer',
|
||
activeTopic === topic && 'clr-selected'
|
||
)}
|
||
title={describeHelpTopic(topic)}
|
||
onClick={() => onChangeTopic(topic)}
|
||
>
|
||
{labelHelpTopic(topic)}
|
||
</div>
|
||
)}
|
||
</div>);
|
||
}
|
||
|
||
export default TopicsList; |