Skip to content

Commit

Permalink
fix(frontend): Fix styling inconsistencies in input elements (#8337)
Browse files Browse the repository at this point in the history
- Apply consistent border styling to `Input`, `Select`, and `Textarea`
   - Remove `rounded-xl` from node input elements

- Add `whitespace-nowrap` to `CustomNode` header category tags

---------

Co-authored-by: Zamil Majdy <[email protected]>
  • Loading branch information
Pwuts and majdyz authored Oct 15, 2024
1 parent a2ef456 commit 97015a9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion autogpt_platform/frontend/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;
--border: 240 5.9% 90%;
--input: 240 5.9% 90%;
--input: 240 5.9% 85%;
--ring: 240 5.9% 10%;
--radius: 0.5rem;
--chart-1: 12 76% 61%;
Expand Down Expand Up @@ -72,4 +72,12 @@
body {
@apply bg-background text-foreground;
}

.agpt-border-input {
@apply border-input focus-visible:border-gray-400 focus-visible:outline-none;
}

.agpt-shadow-input {
@apply shadow-sm focus-visible:shadow-md;
}
}
2 changes: 1 addition & 1 deletion autogpt_platform/frontend/src/components/CustomNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ export function CustomNode({
<Badge
key={category.category}
variant="outline"
className={`mr-5 ${getPrimaryCategoryColor([category])} rounded-xl border border-gray-300 opacity-50`}
className={`mr-5 ${getPrimaryCategoryColor([category])} whitespace-nowrap rounded-xl border border-gray-300 opacity-50`}
>
{beautifyString(category.category.toLowerCase())}
</Badge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ const NodeKeyValueInput: FC<{
</div>
))}
<Button
className="rounded-xl bg-gray-200 font-normal text-black hover:text-white"
className="bg-gray-200 font-normal text-black hover:text-white"
disabled={
keyValuePairs.length > 0 &&
!keyValuePairs[keyValuePairs.length - 1].key
Expand Down Expand Up @@ -567,7 +567,7 @@ const NodeArrayInput: FC<{
);
})}
<Button
className="w-[183p] rounded-xl bg-gray-200 font-normal text-black hover:text-white"
className="w-[183p] bg-gray-200 font-normal text-black hover:text-white"
onClick={() =>
handleInputChange(selfKey, [...entries, isItemObject ? {} : ""])
}
Expand Down Expand Up @@ -633,7 +633,7 @@ const NodeStringInput: FC<{
schema?.placeholder || `Enter ${beautifyString(displayName)}`
}
onBlur={(e) => handleInputChange(selfKey, e.target.value)}
className="rounded-xl pr-8 read-only:cursor-pointer read-only:text-gray-500"
className="pr-8 read-only:cursor-pointer read-only:text-gray-500"
/>
<Button
variant="ghost"
Expand Down Expand Up @@ -685,7 +685,7 @@ export const NodeTextBoxInput: FC<{
schema?.placeholder || `Enter ${beautifyString(displayName)}`
}
onChange={(e) => handleInputChange(selfKey, e.target.value)}
className="h-full w-full resize-none overflow-hidden rounded-xl border-none bg-transparent text-lg text-black outline-none"
className="h-full w-full resize-none overflow-hidden border-none bg-transparent text-lg text-black outline-none"
style={{
fontSize: "min(1em, 16px)",
lineHeight: "1.2",
Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/frontend/src/components/ui/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
"flex h-9 w-full rounded-md border border-gray-300 bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-500 focus-visible:border-gray-400 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
"agpt-border-input agpt-shadow-input flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-500 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-gray-400",
type == "file" ? "pb-0.5 pt-1.5" : "", // fix alignment
className,
)}
Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/frontend/src/components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-neutral-200 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-white placeholder:text-neutral-500 focus:outline-none focus:ring-1 focus:ring-neutral-950 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800 dark:ring-offset-neutral-950 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-300 [&>span]:line-clamp-1",
"agpt-border-input agpt-shadow-input flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm ring-offset-white placeholder:text-neutral-500 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=open]:border-gray-400 dark:placeholder:text-neutral-400 [&>span]:line-clamp-1",
className,
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/frontend/src/components/ui/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
"agpt-border-input flex min-h-[80px] w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
ref={ref}
Expand Down

0 comments on commit 97015a9

Please sign in to comment.