Skip to content

Commit

Permalink
feat: add ghost variant to input
Browse files Browse the repository at this point in the history
Signed-off-by: tylerslaton <[email protected]>
  • Loading branch information
tylerslaton committed Oct 22, 2024
1 parent ddeb7e2 commit 2f7155c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
6 changes: 4 additions & 2 deletions ui/admin/app/components/agent/AgentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,19 @@ export function AgentForm({ agent, onSubmit, onChange }: AgentFormProps) {
<Form {...form}>
<form onSubmit={handleSubmit} className="space-y-4">
<ControlledInput
variant="ghost"
autoComplete="off"
control={form.control}
name="name"
className="text-3xl shadow-none cursor-pointer hover:border-primary px-0 mb-0 font-bold outline-none border-transparent focus:border-primary"
className="text-3xl"
/>
<ControlledInput
variant="ghost"
control={form.control}
autoComplete="off"
name="description"
placeholder="Add a description..."
className="text-xl text-muted-foreground font-semibold shadow-none cursor-pointer hover:border-primary px-0 outline-none border-transparent focus:border-primary"
className="text-xl text-muted-foreground"
/>
</form>
</Form>
Expand Down
2 changes: 1 addition & 1 deletion ui/admin/app/components/agent/PastThreads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
PopoverTrigger,
} from "~/components/ui/popover";

import { TypographyH4, TypographyP } from "../Typography";
import { TypographyP } from "../Typography";

interface PastThreadsProps {
agentId: string;
Expand Down
29 changes: 22 additions & 7 deletions ui/admin/app/components/ui/input.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
import { type VariantProps, cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "~/lib/utils";

export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
const inputVariants = cva(
"flex h-9 w-full rounded-md px-3 bg-transparent border border-input text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
{
variants: {
variant: {
default: "",
ghost: "shadow-none cursor-pointer hover:border-primary px-0 mb-0 font-bold outline-none border-transparent focus:border-primary",
},
},
defaultVariants: {
variant: "default",
},
}
);

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement>,
VariantProps<typeof inputVariants> {}

const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
({ className, variant, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
className={cn(inputVariants({ variant, className }))}
ref={ref}
{...props}
/>
Expand All @@ -21,4 +36,4 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
);
Input.displayName = "Input";

export { Input };
export { Input, inputVariants };
1 change: 0 additions & 1 deletion ui/admin/app/routes/_auth.agents.$agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@remix-run/react";
import { useCallback } from "react";
import { $params, $path } from "remix-routes";
import { z } from "zod";

import { AgentService } from "~/lib/service/api/agentService";
import { QueryParamSchemas } from "~/lib/service/routeQueryParams";
Expand Down

0 comments on commit 2f7155c

Please sign in to comment.