1 import { type FC, useEffect, useState } from 'react';
3 import { Card } from '@proton/atoms';
4 import { type ModalProps, ModalTwoContent, ModalTwoHeader } from '@proton/components';
5 import { PassModal } from '@proton/pass/components/Layout/Modal/PassModal';
6 import { useSessionLockPinSubmitEffect } from '@proton/pass/hooks/useSessionLockPinSubmitEffect';
8 import { PinCodeInput } from './PinCodeInput';
10 type Props = Omit<ModalProps, 'onSubmit'> & {
12 assistiveText?: string;
14 onSubmit: (pin: string) => void;
17 export const PinUnlockModal: FC<Props> = ({ title, assistiveText, loading, onSubmit, ...modalProps }) => {
18 const [value, setValue] = useState<string>('');
19 useSessionLockPinSubmitEffect(value, { onSubmit });
22 if (!modalProps.open) setValue('');
23 }, [modalProps.open]);
26 <PassModal {...modalProps} size="small">
27 <ModalTwoHeader title={title} />
28 <ModalTwoContent className="mb-8">
30 <Card rounded className="text-sm mb-7">
34 <PinCodeInput loading={loading} value={value} onValue={setValue} />