mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 03:56:23 +08:00
refactor: follow correct react rules (#3119)
(cherry picked from commit 6caf934d47)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { TourModal } from '@affine/component/tour-modal';
|
||||
import { useAtom } from 'jotai';
|
||||
import type { FC } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
|
||||
import { openOnboardingModalAtom } from '../../atoms';
|
||||
import { guideOnboardingAtom } from '../../atoms/guide';
|
||||
|
||||
export const OnboardingModal: FC = memo(function OnboardingModal() {
|
||||
const [open, setOpen] = useAtom(openOnboardingModalAtom);
|
||||
const [guideOpen, setShowOnboarding] = useAtom(guideOnboardingAtom);
|
||||
const onCloseTourModal = useCallback(() => {
|
||||
setShowOnboarding(false);
|
||||
setOpen(false);
|
||||
}, [setOpen, setShowOnboarding]);
|
||||
|
||||
return (
|
||||
<TourModal open={!open ? guideOpen : open} onClose={onCloseTourModal} />
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user