Files
supabase/apps/studio/components/ui/PasswordStrengthBar.tsx
T
754ee55cd0 chore: update themes and add dark-new theme set (#20865)
* chore: update themes and add dark-new theme set

* chore: update

* add deep dark css theme

* fix issue with wrong class

* chore: add `bg-studio` as a custom remapped color for studio background

* updated surface classes to use a surface-75.

* update backgrounds and borders

* Update CardButton.tsx

* Update NavigationIconButton.tsx

* chore: add theme selection

* Update package.json

* Update index.ts

* Update package.json

* update alias

* Update ThemeSettings.tsx

* chore: split up theme support

* remove old code

* Update index.ts

* add back in

* Update ThemeSettingsOld.tsx

* fix issue with system theme leaking through

* reset themes

* update imports

* packagelock updated

* Update ThemeSettingsWithPreferredTheme.tsx

* Update system.svg

* Update NavigationIconButton.tsx

* Update NavigationBar.tsx

* update

* Update light.css

* updated some colors

* light mode updated

* hacked

* prettier

---------

Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
2024-02-15 16:56:18 +01:00

53 lines
1.6 KiB
TypeScript

import { PASSWORD_STRENGTH_COLOR, PASSWORD_STRENGTH_PERCENTAGE } from 'lib/constants'
interface Props {
passwordStrengthScore: number
passwordStrengthMessage: string
password: string
generateStrongPassword: () => void
}
const PasswordStrengthBar = ({
passwordStrengthScore = 0,
passwordStrengthMessage = '',
password = '',
generateStrongPassword,
}: Props) => {
return (
<>
{password && (
<div
aria-valuemax={100}
aria-valuemin={0}
aria-valuenow={(PASSWORD_STRENGTH_PERCENTAGE as any)[passwordStrengthScore]}
aria-valuetext={(PASSWORD_STRENGTH_PERCENTAGE as any)[passwordStrengthScore]}
role="progressbar"
className="mb-2 overflow-hidden transition-all border rounded bg-studio"
>
<div
style={{
width: (PASSWORD_STRENGTH_PERCENTAGE as any)[passwordStrengthScore],
}}
className={`relative h-2 w-full ${
(PASSWORD_STRENGTH_COLOR as any)[passwordStrengthScore]
} transition-all duration-500 ease-out shadow-inner`}
></div>
</div>
)}
<p>
{passwordStrengthMessage
? passwordStrengthMessage
: 'This is the password to your postgres database, so it must be strong and hard to guess.'}{' '}
<span
className="text-brand opacity-50 underline hover:opacity-100 transition cursor-pointer"
onClick={generateStrongPassword}
>
Generate a password
</span>
</p>
</>
)
}
export default PasswordStrengthBar