Skip to content

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

style: correct react select disabled styling

Scott Wilsone07cde4e9b8f
diff --git a/frontend/src/components/v3/generic/ReactSelect/styles.ts b/frontend/src/components/v3/generic/ReactSelect/styles.ts
index 2046737a01..c27b5348ce 100644
--- a/frontend/src/components/v3/generic/ReactSelect/styles.ts
+++ b/frontend/src/components/v3/generic/ReactSelect/styles.ts
@@ -3,10 +3,12 @@ import { ClassNamesConfig, GroupBase, StylesConfig } from "react-select";
import { cn } from "../../utils";
export const selectClassNames: ClassNamesConfig<unknown, boolean, GroupBase<unknown>> = {
- control: ({ isFocused }) =>
+ control: ({ isFocused, isDisabled }) =>
cn(
- "!min-h-9 w-full cursor-pointer overflow-hidden rounded-md border bg-transparent py-1 pr-1 pl-2 text-sm",
- isFocused ? "border-ring ring-[3px] ring-ring/50" : "border-border hover:border-foreground/20"
+ "!min-h-9 w-full cursor-pointer overflow-hidden rounded-md border border-border bg-transparent py-1 pr-1 pl-2 text-sm",
+ isFocused && "border-ring ring-[3px] ring-ring/50",
+ !isFocused && !isDisabled && "hover:border-foreground/20",
+ isDisabled && "pointer-events-none cursor-not-allowed opacity-50"
),
placeholder: () => "text-muted text-sm",
input: () => "text-foreground text-sm",
@@ -56,9 +58,9 @@ export const getSelectClassNames = (
isError?: boolean
): ClassNamesConfig<unknown, boolean, GroupBase<unknown>> => ({
...selectClassNames,
- control: ({ isFocused }) =>
+ control: ({ isFocused, isDisabled }) =>
cn(
- "!min-h-9 w-full cursor-pointer overflow-hidden rounded-md border bg-transparent py-1 pr-1 pl-2 text-sm",
+ "!min-h-9 w-full cursor-pointer overflow-hidden rounded-md border border-border bg-transparent py-1 pr-1 pl-2 text-sm",
// eslint-disable-next-line no-nested-ternary
isError
? isFocused
@@ -66,6 +68,7 @@ export const getSelectClassNames = (
: "border-danger"
: isFocused
? "border-ring ring-[3px] ring-ring/50"
- : "border-border hover:border-foreground/20"
+ : !isDisabled && "hover:border-foreground/20",
+ isDisabled && "pointer-events-none cursor-not-allowed opacity-50"
)
});