|
1 | | -import { Button } from '@gouvfr-lasuite/cunningham-react'; |
2 | | -import { |
3 | | - DropdownMenu, |
4 | | - DropdownMenuOption, |
5 | | - OnboardingModal, |
6 | | - OnboardingStep, |
7 | | -} from '@gouvfr-lasuite/ui-kit'; |
8 | | -import { type MouseEvent, useCallback, useMemo, useState } from 'react'; |
9 | | -import { useTranslation } from 'react-i18next'; |
10 | | -import { css } from 'styled-components'; |
11 | | - |
12 | | -import WandAndStarsIcon from '@/assets/icons/wand-and-stars.svg'; |
13 | | -import { Box, Icon } from '@/components'; |
| 1 | +import { OnBoarding } from '@/features/on-boarding/components/OnBoarding'; |
14 | 2 |
|
15 | 3 | export const LeftPanelHelpMenu = () => { |
16 | | - const { t } = useTranslation(); |
17 | | - const [isMenuOpen, setIsMenuOpen] = useState(false); |
18 | | - const [isModalOpen, setIsModalOpen] = useState(false); |
19 | | - |
20 | | - const openModal = useCallback(() => { |
21 | | - setIsModalOpen(true); |
22 | | - }, []); |
23 | | - |
24 | | - const closeModal = useCallback(() => { |
25 | | - setIsModalOpen(false); |
26 | | - }, []); |
27 | | - |
28 | | - const toggleMenu = useCallback( |
29 | | - (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => { |
30 | | - event.preventDefault(); |
31 | | - event.stopPropagation(); |
32 | | - setIsMenuOpen((open) => !open); |
33 | | - }, |
34 | | - [], |
35 | | - ); |
36 | | - |
37 | | - const steps = useMemo<OnboardingStep[]>( |
38 | | - () => [ |
39 | | - { |
40 | | - icon: <Icon iconName="edit" $size="20px" aria-hidden="true" />, |
41 | | - title: t('Onboarding step 1 title'), |
42 | | - description: t('Onboarding step 1 description'), |
43 | | - }, |
44 | | - { |
45 | | - icon: <Icon iconName="account_tree" $size="20px" aria-hidden="true" />, |
46 | | - title: t('Onboarding step 2 title'), |
47 | | - description: t('Onboarding step 2 description'), |
48 | | - }, |
49 | | - { |
50 | | - icon: <Icon iconName="share" $size="20px" aria-hidden="true" />, |
51 | | - title: t('Onboarding step 3 title'), |
52 | | - description: t('Onboarding step 3 description'), |
53 | | - }, |
54 | | - ], |
55 | | - [t], |
56 | | - ); |
57 | | - |
58 | | - const options = useMemo<DropdownMenuOption[]>( |
59 | | - () => [ |
60 | | - { |
61 | | - label: t('Onboarding'), |
62 | | - icon: <WandAndStarsIcon aria-hidden="true" />, |
63 | | - callback: openModal, |
64 | | - }, |
65 | | - ], |
66 | | - [openModal, t], |
67 | | - ); |
68 | | - |
69 | | - return ( |
70 | | - <> |
71 | | - <Box |
72 | | - $css={css` |
73 | | - .c__dropdown-menu-trigger { |
74 | | - display: flex; |
75 | | - justify-content: flex-start; |
76 | | - } |
77 | | - `} |
78 | | - > |
79 | | - <DropdownMenu |
80 | | - options={options} |
81 | | - isOpen={isMenuOpen} |
82 | | - onOpenChange={setIsMenuOpen} |
83 | | - > |
84 | | - <Button |
85 | | - aria-label={t('Open onboarding menu')} |
86 | | - color="neutral" |
87 | | - variant="tertiary" |
88 | | - iconPosition="left" |
89 | | - icon={ |
90 | | - <Icon |
91 | | - $withThemeInherited |
92 | | - iconName="help_outline" |
93 | | - aria-hidden="true" |
94 | | - /> |
95 | | - } |
96 | | - onClick={toggleMenu} |
97 | | - /> |
98 | | - </DropdownMenu> |
99 | | - </Box> |
100 | | - |
101 | | - <OnboardingModal |
102 | | - isOpen={isModalOpen} |
103 | | - appName={t('Docs')} |
104 | | - mainTitle={t('Docs onboarding title')} |
105 | | - steps={steps} |
106 | | - hideContent |
107 | | - onClose={closeModal} |
108 | | - onComplete={closeModal} |
109 | | - /> |
110 | | - </> |
111 | | - ); |
| 4 | + return <OnBoarding />; |
112 | 5 | }; |
0 commit comments