Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

unify and standardize and shared button and icon button variant styling

Scott Wilson750c4eefe554
diff --git a/frontend/src/components/v3/generic/Button/Button.tsx b/frontend/src/components/v3/generic/Button/Button.tsx
index 5420d00bd1..075b7850e0 100644
--- a/frontend/src/components/v3/generic/Button/Button.tsx
+++ b/frontend/src/components/v3/generic/Button/Button.tsx
@@ -9,29 +9,31 @@ import { cn } from "@app/components/v3/utils";
const buttonVariants = cva(
cn(
"inline-flex items-center rounded-md active:scale-[0.99] justify-center border cursor-pointer whitespace-nowrap",
- " text-sm transition-all disabled:pointer-events-none disabled:opacity-75 shrink-0",
+ " text-sm transition-all disabled:pointer-events-none disabled:opacity-50 shrink-0",
"[&>svg]:pointer-events-none [&>svg]:shrink-0",
"focus-visible:ring-ring outline-0 focus-visible:ring-2 select-none"
),
{
variants: {
variant: {
- outline: "text-foreground hover:bg-foreground/10 border-border hover:border-foreground/20",
- ghost: "text-foreground hover:bg-foreground/10 border-transparent",
+ outline:
+ "text-foreground hover:bg-foreground/10 border-border hover:border-foreground/20 data-[state=open]:bg-foreground/10 data-[state=open]:border-foreground/20",
+ ghost:
+ "text-foreground hover:bg-foreground/10 border-transparent data-[state=open]:bg-foreground/10",
neutral:
- "border-neutral/25 bg-neutral/10 text-foreground hover:bg-neutral/15 hover:border-neutral/30",
+ "border-neutral/25 bg-neutral/10 text-foreground hover:bg-neutral/15 hover:border-neutral/30 data-[state=open]:bg-neutral/15 data-[state=open]:border-neutral/30",
project:
- "border-project/25 bg-project/10 text-foreground hover:bg-project/15 hover:border-project/30",
- org: "border-org/25 bg-org/10 text-foreground hover:bg-org/15 hover:border-org/30",
+ "border-project/25 bg-project/10 text-foreground hover:bg-project/15 hover:border-project/30 data-[state=open]:bg-project/15 data-[state=open]:border-project/30",
+ org: "border-org/25 bg-org/10 text-foreground hover:bg-org/15 hover:border-org/30 data-[state=open]:bg-org/15 data-[state=open]:border-org/30",
"sub-org":
- "border-sub-org/25 bg-sub-org/10 text-foreground hover:bg-sub-org/15 hover:border-sub-org/30",
+ "border-sub-org/25 bg-sub-org/10 text-foreground hover:bg-sub-org/15 hover:border-sub-org/30 data-[state=open]:bg-sub-org/15 data-[state=open]:border-sub-org/30",
success:
- "border-success/25 bg-success/10 text-foreground hover:bg-success/15 hover:border-success/30",
- info: "border-info/25 bg-info/10 text-foreground hover:bg-info/15 hover:border-info/30",
+ "border-success/25 bg-success/10 text-foreground hover:bg-success/15 hover:border-success/30 data-[state=open]:bg-success/15 data-[state=open]:border-success/30",
+ info: "border-info/25 bg-info/10 text-foreground hover:bg-info/15 hover:border-info/30 data-[state=open]:bg-info/15 data-[state=open]:border-info/30",
warning:
- "border-warning/25 bg-warning/10 text-foreground hover:bg-warning/15 hover:border-warning/30",
+ "border-warning/25 bg-warning/10 text-foreground hover:bg-warning/15 hover:border-warning/30 data-[state=open]:bg-warning/15 data-[state=open]:border-warning/30",
danger:
- "border-danger/25 bg-danger/10 text-foreground hover:bg-danger/15 hover:border-danger/30"
+ "border-danger/25 bg-danger/10 text-foreground hover:bg-danger/15 hover:border-danger/30 data-[state=open]:bg-danger/15 data-[state=open]:border-danger/30"
},
size: {
xs: "h-7 px-2 text-xs rounded-sm [&>svg]:size-3 gap-1.5",
diff --git a/frontend/src/components/v3/generic/IconButton/IconButton.tsx b/frontend/src/components/v3/generic/IconButton/IconButton.tsx
index 0ba4ba670d..68dd2898a1 100644
--- a/frontend/src/components/v3/generic/IconButton/IconButton.tsx
+++ b/frontend/src/components/v3/generic/IconButton/IconButton.tsx
@@ -10,31 +10,33 @@ import { cn } from "@app/components/v3/utils";
const iconButtonVariants = cva(
cn(
"inline-flex items-center active:scale-[0.99] justify-center border cursor-pointer whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&>svg]:shrink-0",
- "focus-visible:ring-ring outline-0 focus-visible:ring-2",
- "data-[state=open]:bg-foreground/5"
+ "focus-visible:ring-ring outline-0 focus-visible:ring-2"
),
{
variants: {
variant: {
default:
- "border-foreground bg-foreground text-background hover:bg-foreground/90 hover:border-foreground/90",
+ "border-foreground bg-foreground text-background hover:bg-foreground/90 hover:border-foreground/90 data-[state=open]:bg-foreground/90 data-[state=open]:border-foreground/90",
accent:
- "border-accent/10 bg-accent/40 text-foreground hover:bg-accent/50 hover:border-accent/20",
- outline: "text-foreground hover:bg-foreground/20 border-border hover:border-foreground/50",
- ghost: "text-foreground hover:bg-foreground/10 border-transparent",
- "ghost-muted": "text-muted hover:text-foreground hover:bg-foreground/10 border-transparent",
+ "border-accent/10 bg-accent/40 text-foreground hover:bg-accent/50 hover:border-accent/20 data-[state=open]:bg-accent/50 data-[state=open]:border-accent/20",
+ outline:
+ "text-foreground hover:bg-foreground/10 border-border hover:border-foreground/20 data-[state=open]:bg-foreground/10 data-[state=open]:border-foreground/20",
+ ghost:
+ "text-foreground hover:bg-foreground/10 border-transparent data-[state=open]:bg-foreground/10",
+ "ghost-muted":
+ "text-muted hover:text-foreground hover:bg-foreground/10 border-transparent data-[state=open]:text-foreground data-[state=open]:bg-foreground/10",
project:
- "border-project/25 bg-project/10 text-foreground hover:bg-project/15 hover:border-project/30",
- org: "border-org/25 bg-org/10 text-foreground hover:bg-org/15 hover:border-org/30",
+ "border-project/25 bg-project/10 text-foreground hover:bg-project/15 hover:border-project/30 data-[state=open]:bg-project/15 data-[state=open]:border-project/30",
+ org: "border-org/25 bg-org/10 text-foreground hover:bg-org/15 hover:border-org/30 data-[state=open]:bg-org/15 data-[state=open]:border-org/30",
"sub-org":
- "border-sub-org/25 bg-sub-org/10 text-foreground hover:bg-sub-org/15 hover:border-sub-org/30",
+ "border-sub-org/25 bg-sub-org/10 text-foreground hover:bg-sub-org/15 hover:border-sub-org/30 data-[state=open]:bg-sub-org/15 data-[state=open]:border-sub-org/30",
success:
- "border-success/25 bg-success/10 text-foreground hover:bg-success/15 hover:border-success/30",
- info: "border-info/25 bg-info/10 text-foreground hover:bg-info/15 hover:border-info/30",
+ "border-success/25 bg-success/10 text-foreground hover:bg-success/15 hover:border-success/30 data-[state=open]:bg-success/15 data-[state=open]:border-success/30",
+ info: "border-info/25 bg-info/10 text-foreground hover:bg-info/15 hover:border-info/30 data-[state=open]:bg-info/15 data-[state=open]:border-info/30",
warning:
- "border-warning/25 bg-warning/10 text-foreground hover:bg-warning/15 hover:border-warning/30",
+ "border-warning/25 bg-warning/10 text-foreground hover:bg-warning/15 hover:border-warning/30 data-[state=open]:bg-warning/15 data-[state=open]:border-warning/30",
danger:
- "border-danger/25 bg-danger/10 text-foreground hover:bg-danger/15 hover:border-danger/30"
+ "border-danger/25 bg-danger/10 text-foreground hover:bg-danger/15 hover:border-danger/30 data-[state=open]:bg-danger/15 data-[state=open]:border-danger/30"
},
size: {
xs: "h-7 w-7 [&>svg]:size-4 rounded-sm [&>svg]:stroke-[1.75]",