Files
supabase/apps/studio/components/ui/PasswordStrengthBar.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

50 lines
1.6 KiB
TypeScript

import { InlineLinkClassName } from './InlineLink'
import { PASSWORD_STRENGTH_COLOR, PASSWORD_STRENGTH_PERCENTAGE } from '@/lib/constants'
import { PasswordStrengthScore } from '@/lib/password-strength'
interface Props {
passwordStrengthScore: PasswordStrengthScore
passwordStrengthMessage: string
password: string
generateStrongPassword: () => void
}
export const PasswordStrengthBar = ({
passwordStrengthScore = 0,
passwordStrengthMessage = '',
password = '',
generateStrongPassword,
}: Props) => {
return (
<>
{password && (
<div
aria-valuemax={100}
aria-valuemin={0}
aria-valuenow={PASSWORD_STRENGTH_PERCENTAGE[passwordStrengthScore]}
aria-valuetext={`${PASSWORD_STRENGTH_PERCENTAGE[passwordStrengthScore]}%`}
role="progressbar"
className="mb-2 overflow-hidden transition-all border rounded-sm bg-200 w-full"
>
<div
style={{
width: `${PASSWORD_STRENGTH_PERCENTAGE[passwordStrengthScore]}%`,
}}
className={`relative h-1 w-full ${PASSWORD_STRENGTH_COLOR[passwordStrengthScore]} transition-all duration-500 ease-out shadow-inner`}
/>
</div>
)}
<p>
{(passwordStrengthMessage
? passwordStrengthMessage
: 'This is the password to your Postgres database, so it must be strong and hard to guess.') +
' '}
<button type="button" className={InlineLinkClassName} onClick={generateStrongPassword}>
Generate a password
</button>
.
</p>
</>
)
}