diff --git a/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx b/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx index da571d219..75fe08af8 100644 --- a/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx +++ b/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx @@ -1,5 +1,6 @@ "use client"; import { Alert, AlertDescription, AlertTitle } from "@rallly/ui/alert"; +import { Input } from "@rallly/ui/input"; import { Label } from "@rallly/ui/label"; import { InfoIcon, LogOutIcon, UserXIcon } from "lucide-react"; import Head from "next/head"; @@ -13,7 +14,6 @@ import { SettingsContent, SettingsSection, } from "@/components/settings/settings"; -import { TextInput } from "@/components/text-input"; import { Trans } from "@/components/trans"; import { useUser } from "@/components/user-provider"; @@ -35,7 +35,7 @@ export const ProfilePage = () => { - {t("email")} - { - { - { const url = `${ @@ -71,10 +71,9 @@ export const VerifyCode: React.FunctionComponent<{ }} />

- { - { {t("email")} {!isEmailRequired ? ` (${t("optional")})` : null} - { - + )} @@ -66,7 +66,7 @@ export const ProfileSettings = () => { - + )} diff --git a/apps/web/src/components/text-input.tsx b/apps/web/src/components/text-input.tsx deleted file mode 100644 index c1f6bbf27..000000000 --- a/apps/web/src/components/text-input.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import clsx from "clsx"; -import * as React from "react"; - -export interface TextInputProps - extends React.DetailedHTMLProps< - React.InputHTMLAttributes, - HTMLInputElement - > { - error?: boolean; - proportions?: "lg" | "md"; -} - -export const TextInput = React.forwardRef( - function TextInput( - { className, error, proportions: size = "md", ...forwardProps }, - ref, - ) { - return ( - - ); - }, -); diff --git a/apps/web/src/style.css b/apps/web/src/style.css index 3545d9f1a..2f7cf8135 100644 --- a/apps/web/src/style.css +++ b/apps/web/src/style.css @@ -28,7 +28,12 @@ input, select, textarea { - @apply rounded outline-none focus:ring-gray-300 focus-visible:ring-1; + @apply rounded outline-none; + } + + input, + textarea { + @apply focus:border-primary-400 hover:border-gray-300; } #floating-ui-root { @@ -45,6 +50,8 @@ } .input { @apply appearance-none border px-2 text-gray-800 placeholder:text-gray-500; + @apply focus-visible:ring-offset-input-background focus-visible:ring-1 focus-visible:ring-offset-1; + @apply focus-visible:border-primary-400 focus-visible:ring-primary-100; } input.input { @apply h-9; diff --git a/packages/ui/src/button.tsx b/packages/ui/src/button.tsx index 07181df03..ef22809d3 100644 --- a/packages/ui/src/button.tsx +++ b/packages/ui/src/button.tsx @@ -7,7 +7,10 @@ import * as React from "react"; import { cn } from "@rallly/ui"; const buttonVariants = cva( - "inline-flex border font-medium disabled:text-muted-foreground focus:ring-1 focus:ring-gray-300 disabled:bg-muted disabled:pointer-events-none select-none items-center justify-center whitespace-nowrap rounded-md border", + cn( + "inline-flex border font-medium disabled:text-muted-foreground disabled:bg-muted disabled:pointer-events-none select-none items-center justify-center whitespace-nowrap rounded-md border", + "focus-visible:ring-offset-input-background focus-visible:border-primary-400 focus-visible:ring-2 focus-visible:ring-indigo-100", + ), { variants: { variant: { diff --git a/packages/ui/src/dialog.tsx b/packages/ui/src/dialog.tsx index 79c551297..dcb313ed0 100644 --- a/packages/ui/src/dialog.tsx +++ b/packages/ui/src/dialog.tsx @@ -52,7 +52,7 @@ const DialogContent = React.forwardRef< ) => ( -
+
); DialogHeader.displayName = "DialogHeader"; diff --git a/packages/ui/src/input.tsx b/packages/ui/src/input.tsx index 9f937f749..69536db62 100644 --- a/packages/ui/src/input.tsx +++ b/packages/ui/src/input.tsx @@ -1,16 +1,45 @@ import * as React from "react"; import { cn } from "@rallly/ui"; +import { cva } from "class-variance-authority"; -export type InputProps = React.InputHTMLAttributes; +export type InputProps = Omit< + React.InputHTMLAttributes, + "size" +> & { + size?: "sm" | "md" | "lg"; + error?: boolean; +}; + +const inputVariants = cva( + cn( + "border-input placeholder:text-muted-foreground flex h-9 w-full rounded border bg-transparent file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50", + ), + { + variants: { + size: { + sm: "h-6 text-sm px-1", + md: "h-9 text-base px-2", + lg: "h-12 text-lg px-3", + }, + }, + defaultVariants: { + size: "md", + }, + }, +); const Input = React.forwardRef( - ({ className, type, ...props }, ref) => { + ({ className, size, type, error, ...props }, ref) => { return ( ( return (