CLick on advisories title

This commit is contained in:
Hristo Nedelkov 2023-10-20 13:43:55 +03:00
parent b649237532
commit 2ce4cc496d
1 changed files with 9 additions and 5 deletions

View File

@ -12,13 +12,17 @@ type AdvisoryTopicsType = {
const Advisories = () => { const Advisories = () => {
const { subStepAdvisories } = useSelector((state: RootState) => state.advisories) const { subStepAdvisories } = useSelector((state: RootState) => state.advisories)
const [selectedTitle, setSelectedTitle] = useState(Object.keys(advisoryTopics)[0])
const unicodeNumbers = ['➀', '➁', '➂', '➃', '➄', '➅'] const unicodeNumbers = ['➀', '➁', '➂', '➃', '➄', '➅']
const advisoriesIcons = unicodeNumbers.map((number, index) => const advisoriesIcons = unicodeNumbers.map((number, index) => {
index <= subStepAdvisories ? '✓' : number, if (selectedTitle === Object.keys(advisoryTopics)[index]) {
) return '✓'
} else {
return index <= subStepAdvisories ? '✓' : number
}
})
const [selectedTitle, setSelectedTitle] = useState(Object.keys(advisoryTopics)[0])
useEffect(() => { useEffect(() => {
setSelectedTitle(Object.keys(advisoryTopics)[subStepAdvisories]) setSelectedTitle(Object.keys(advisoryTopics)[subStepAdvisories])
}, [subStepAdvisories]) }, [subStepAdvisories])
@ -58,7 +62,7 @@ const Advisories = () => {
<Text <Text
size={19} size={19}
weight={isCurrent(title) ? 'semibold' : ''} weight={isCurrent(title) ? 'semibold' : ''}
color={isCurrent(title) ? 'blue' : ''} color={title === selectedTitle ? 'blue' : isCurrent(title) ? 'blue' : ''}
> >
{title} {title}
</Text> </Text>