import clsx from 'clsx'; import { useEffect, useState } from 'react'; import { type getPasswordStrength } from '@sd/client'; export interface PasswordMeterProps { password: string; } export const PasswordMeter = (props: PasswordMeterProps) => { const [getStrength, setGetStrength] = useState(); const { score, scoreText } = getStrength ? getStrength(props.password) : { score: 0, scoreText: 'Loading...' }; useEffect(() => { let cancelled = false; import('@sd/client').then(({ getPasswordStrength }) => { if (cancelled) return; setGetStrength(() => getPasswordStrength); }); return () => { cancelled = true; }; }, []); return (

Password strength

{scoreText}
); };