Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/components/ui/input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type * as React from "react"
import { cn } from "@/lib/utils"
import { Glass } from "../glass"

type InputProps = React.ComponentProps<"input"> & {
icon?: React.ReactNode
containerClassName?: string
}

function Input({ icon, className, containerClassName, ...inputProps }: InputProps) {
return (
<Glass
className={cn(
"inline-flex w-full items-center gap-2.5",
"border border-white/50",
icon ? "px-6 py-3" : "px-4 py-2",
"rounded-buttonsM",
"bg-background-blur",
containerClassName
)}
>
{icon && <span className="flex h-6 w-6 items-center justify-center shrink-0 text-text-primary"> {icon} </span>}

<input
type={inputProps.type}
placeholder={inputProps.placeholder ?? undefined}
data-slot="input"
{...inputProps}
className={cn(
"w-full bg-transparent border-none outline-none",
"typo-body-medium text-text-primary placeholder:text-text-secondary",
className
)}
/>
</Glass>
)
}

export { Input }
10 changes: 9 additions & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
import { extendTailwindMerge } from "tailwind-merge"

const twMerge = extendTailwindMerge({
extend: {
theme: {
radius: ["images", "rectangles", "buttonsM", "buttonsL"], // custom rounded classes from figma
},
},
})

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
Expand Down