diff --git a/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx b/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx index 8648116def..dfa83e3f02 100644 --- a/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx +++ b/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx @@ -1,43 +1,76 @@ -import type { CSSProperties } from 'react'; +import { type CSSProperties, useCallback, useState } from 'react'; import { articles } from './articles'; import { PaperSteps } from './paper-steps'; import * as styles from './style.css'; +import type { ArticleId, ArticleOption } from './types'; interface OnboardingProps { onOpenApp?: () => void; } export const Onboarding = (_: OnboardingProps) => { + const [status, setStatus] = useState<{ + activeId: ArticleId | null; + unfoldingId: ArticleId | null; + }>({ activeId: null, unfoldingId: null }); + + const onFoldChange = useCallback((id: ArticleId, v: boolean) => { + setStatus(s => { + return { + activeId: v ? null : s.activeId, + unfoldingId: v ? null : id, + }; + }); + }, []); + + const onFoldChanged = useCallback((id: ArticleId, v: boolean) => { + setStatus(s => { + return { + activeId: v ? null : id, + unfoldingId: s.unfoldingId, + }; + }); + }, []); + return (