Migrate landing page to app dir (#1587)

* app dir yay

* better docs route

* fix icon sizing

* mobile sidebars

* detect webgl in useEffect

* separate zxcvbn
This commit is contained in:
Brendan Allan
2023-10-16 12:28:16 +08:00
committed by GitHub
parent 4b37d71efe
commit 151c26dfd3
29 changed files with 100 additions and 24 deletions

View File

@@ -1,12 +1,29 @@
import clsx from 'clsx';
import { getPasswordStrength } from '@sd/client';
import { useEffect, useState } from 'react';
import { type getPasswordStrength } from '@sd/client';
export interface PasswordMeterProps {
password: string;
}
export const PasswordMeter = (props: PasswordMeterProps) => {
const { score, scoreText } = getPasswordStrength(props.password);
const [getStrength, setGetStrength] = useState<typeof getPasswordStrength | undefined>();
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 (
<div className="relative">