ConceptPortal-public/rsconcept/frontend/src/pages/ManualsPage/TopicsList.tsx
2023-09-03 18:26:50 +03:00

30 lines
1001 B
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.

import { prefixes } from '../../utils/constants';
import { HelpTopic } from '../../utils/models';
import { mapTopicInfo } from '../../utils/staticUI';
interface TopicsListProps {
activeTopic: HelpTopic
onChangeTopic: (newTopic: HelpTopic) => void
}
function TopicsList({ activeTopic, onChangeTopic }: TopicsListProps) {
return (
<div className='sticky top-0 left-0 border-r border-b min-w-[13rem] pt-2 select-none flex flex-col clr-controls'>
<div className='mb-2 font-semibold text-center'>Справка</div>
{ [... mapTopicInfo.entries()].map(
([topic, info], index) => {
return (
<div key={`${prefixes.topic_list}${index}`}
className={`px-3 py-1 border-y cursor-pointer clr-hover ${activeTopic === topic ? 'font-semibold clr-selected ' : ''}`}
title={info.tooltip}
onClick={() => onChangeTopic(topic)}
>
{info.text}
</div>)
})}
</div>
);
}
export default TopicsList;