index.tsx
31 lines
| 1 | import {createContext, useContext} from 'react'; |
| 2 | import Banner from './Components/Banner'; |
| 3 | import {FeatureNoticeDialog} from './Dialogs'; |
| 4 | |
| 5 | export const OnboardingContext = createContext([]); |
| 6 | |
| 7 | export interface OnboardingStateProps { |
| 8 | showBanner: boolean; |
| 9 | showFeatureNoticeDialog: boolean; |
| 10 | } |
| 11 | |
| 12 | export default function Onboarding() { |
| 13 | const [state, setState] = useContext(OnboardingContext); |
| 14 | |
| 15 | return ( |
| 16 | <> |
| 17 | {state.showBanner && <Banner />} |
| 18 | |
| 19 | {state.showFeatureNoticeDialog && ( |
| 20 | <FeatureNoticeDialog |
| 21 | isEditing={false} |
| 22 | isUpgrading={false} |
| 23 | handleClose={() => setState(prev => ({ |
| 24 | ...prev, |
| 25 | showFeatureNoticeDialog: false |
| 26 | }))} /> |
| 27 | )} |
| 28 | </> |
| 29 | ) |
| 30 | } |
| 31 |