From a0a7129081f135a2a365874e1811cc2b02ceedf3 Mon Sep 17 00:00:00 2001 From: Ubbe Date: Mon, 30 Jun 2025 13:56:55 +0400 Subject: [PATCH] fix(frontend): design system feedback (#10253) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Changes πŸ—οΈ I had a catch-up yesterday with Olivia, we agreed to implement these fixes on our πŸ‘ΆπŸ½ component library ### 1. Update button loading states Screenshot 2025-06-27 at 15 13 12 When `loading`, all buttons will have a grey background and white text, except if it is the `ghost` variant. ### 2. Update new border radius tokens Screenshot 2025-06-27 at 15 15 46 Updated the `border-radius` scale to the one in Figma. [Reference](https://www.figma.com/design/nO9NFynNuicLtkiwvOxrbz/AutoGPT-Design-System?node-id=634-8255&t=hGgDUzLoLdSqpJIe-1). ### 3. Add `secondary` link variant Screenshot 2025-06-27 at 15 13 02 We have 2 types of links, `primary` ( _without underline but shows on hover_ ) and `secondary` ( _with underline_ ) ## Checklist πŸ“‹ #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Run Storybook locally, stories look good --------- Co-authored-by: Abhimanyu Yadav <122007096+Abhi1992002@users.noreply.github.com> --- .../atoms/Button/Button.stories.tsx | 126 ++++++++++++--- .../src/components/atoms/Button/Button.tsx | 25 ++- .../components/atoms/Link/Link.stories.tsx | 144 +++++------------- .../src/components/atoms/Link/Link.tsx | 15 +- .../tokens/border-radius.stories.tsx | 129 +++++++++------- autogpt_platform/frontend/tailwind.config.ts | 12 +- 6 files changed, 260 insertions(+), 191 deletions(-) diff --git a/autogpt_platform/frontend/src/components/atoms/Button/Button.stories.tsx b/autogpt_platform/frontend/src/components/atoms/Button/Button.stories.tsx index 9b3be42fe8..3c6765e26c 100644 --- a/autogpt_platform/frontend/src/components/atoms/Button/Button.stories.tsx +++ b/autogpt_platform/frontend/src/components/atoms/Button/Button.stories.tsx @@ -94,26 +94,48 @@ export const Ghost: Story = { }, }; -export const Link: Story = { - args: { - variant: "link", - children: "Add to library", - }, -}; - // Loading states export const Loading: Story = { args: { loading: true, - children: "Processing...", + children: "Saving...", + }, + parameters: { + docs: { + description: { + story: + "Use contextual loading text that reflects the action being performed (e.g., 'Computing...', 'Processing...', 'Saving...', 'Uploading...', 'Deleting...')", + }, + }, }, }; -export const LoadingSecondary: Story = { +export const LoadingGhost: Story = { args: { - variant: "secondary", + variant: "ghost", loading: true, - children: "Loading...", + children: "Fetching data...", + }, + parameters: { + docs: { + description: { + story: + "Always show contextual loading text that describes what's happening. Avoid generic 'Loading...' text when possible.", + }, + }, + }, +}; + +// Contextual loading examples +export const ContextualLoadingExamples: Story = { + render: renderContextualLoadingExamples, + parameters: { + docs: { + description: { + story: + "Examples of contextual loading text. Always use specific action-based text rather than generic 'Loading...' to give users clear feedback about what's happening.", + }, + }, }, }; @@ -163,6 +185,65 @@ export const AllVariants: Story = { }; // Render functions as function declarations +function renderContextualLoadingExamples() { + return ( +
+
+

+ βœ… Good Examples - Contextual Loading Text +

+
+ + + + + + + + +
+
+ +
+

+ ❌ Avoid - Generic Loading Text +

+
+ + + +
+

+ These examples are disabled to show what NOT to do. Use specific + action-based text instead. +

+
+
+ ); +} + function renderSmallButtons() { return (
@@ -405,6 +486,9 @@ function renderAllVariants() { + @@ -427,6 +511,9 @@ function renderAllVariants() { + @@ -449,6 +536,9 @@ function renderAllVariants() { + @@ -471,6 +561,9 @@ function renderAllVariants() { + @@ -492,17 +585,6 @@ function renderAllVariants() { Other button types
- {/* Link */} -
-
- Link -
-
- -
-
- - {/* Icon */}
Icon diff --git a/autogpt_platform/frontend/src/components/atoms/Button/Button.tsx b/autogpt_platform/frontend/src/components/atoms/Button/Button.tsx index 556b41c052..c829e1afd2 100644 --- a/autogpt_platform/frontend/src/components/atoms/Button/Button.tsx +++ b/autogpt_platform/frontend/src/components/atoms/Button/Button.tsx @@ -19,7 +19,6 @@ const extendedButtonVariants = cva( "bg-transparent border-zinc-700 text-black hover:bg-zinc-100 hover:border-zinc-700 rounded-full disabled:border-zinc-200 disabled:text-zinc-200 disabled:opacity-1", ghost: "bg-transparent border-transparent text-black hover:bg-zinc-50 hover:border-zinc-50 rounded-full disabled:text-zinc-200 disabled:opacity-1", - link: "bg-transparent border-transparent text-black hover:underline rounded-none p-0 h-auto min-w-auto disabled:opacity-1", icon: "bg-white text-black border border-zinc-600 hover:bg-zinc-100 rounded-[96px] disabled:opacity-1", }, size: { @@ -57,6 +56,30 @@ function Button({ }: ButtonProps) { const isDisabled = disabled; + if (loading) { + return variant === "ghost" ? ( + + ) : ( + + ); + } + return (
@@ -174,11 +183,12 @@ export function AllVariants() { variant="h2" className="mb-2 text-xl font-semibold text-zinc-800" > - Complete Border Radius Scale + Design System Border Radius Tokens - All available border radius values in our design system. Each value - can be applied to all corners or specific corners/sides. + All border radius values from our Figma design tokens. Each value + can be applied to all corners or specific corners/sides using our + simplified naming convention.
@@ -221,28 +231,31 @@ export function AllVariants() {
No rounding (0px) -
Small rounding (2px)
-
Default rounding (4px)
-
Medium rounding (6px)
-
Large rounding (8px)
-
Extra large rounding (12px)
-
2X large rounding (16px)
-
3X large rounding (24px)
-
Fully rounded (circular)
+ code={`// Border radius examples - Design System Tokens +
Extra small rounding (4px)
+
Small rounding (8px)
+
Medium rounding (12px)
+
Large rounding (16px)
+
Extra large rounding (20px)
+
2X large rounding (24px)
+
Pill buttons (circular)
-// Directional rounding -
Top corners only
-
Right corners only
-
Bottom corners only
-
Left corners only
+// Directional rounding (works with all sizes) +
Top corners only
+
Right corners only
+
Bottom corners only
+
Left corners only
// Individual corners -
Top-left corner
-
Top-right corner
-
Bottom-left corner
-
Bottom-right corner
`} +
Top-left corner
+
Top-right corner
+
Bottom-left corner
+
Bottom-right corner
+ +// Usage recommendations + +
Card Container
+Input Field`} /> diff --git a/autogpt_platform/frontend/tailwind.config.ts b/autogpt_platform/frontend/tailwind.config.ts index d0607b3412..f154b8931f 100644 --- a/autogpt_platform/frontend/tailwind.config.ts +++ b/autogpt_platform/frontend/tailwind.config.ts @@ -116,11 +116,19 @@ const config = { 96: "24rem", }, borderRadius: { + // Design system border radius tokens from Figma + xs: "0.25rem", // 4px + s: "0.5rem", // 8px + m: "0.75rem", // 12px + l: "1rem", // 16px + xl: "1.25rem", // 20px + "2xl": "1.5rem", // 24px + full: "9999px", // For pill buttons + + // Legacy values - kept for backward compatibility lg: "var(--radius)", md: "calc(var(--radius) - 2px)", sm: "calc(var(--radius) - 4px)", - // Add a full radius for pill-shaped buttons - full: "9999px", }, boxShadow: { subtle: "0px 1px 2px 0px rgba(0,0,0,0.05)",