Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

change active to be variant

Oleg Isonen20bbdce27c15
diff --git a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx
index 5ae320f6b5..cca153a367 100644
--- a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx
+++ b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx
@@ -30,7 +30,10 @@ export const FontFamilyControl = ({
onOpenChange={setIsOpen}
>
{/* @todo this should be part of the design system, probably a varian="button" */}
- <TextField defaultValue={value.value} active={isOpen} />
+ <TextField
+ defaultValue={value.value}
+ variant={isOpen ? "active" : undefined}
+ />
</ValuePickerPopover>
);
};
diff --git a/packages/design-system/src/components/text-field.stories.tsx b/packages/design-system/src/components/text-field.stories.tsx
index 8c27522bbd..e6c54b8a4f 100644
--- a/packages/design-system/src/components/text-field.stories.tsx
+++ b/packages/design-system/src/components/text-field.stories.tsx
@@ -42,6 +42,8 @@ export const Variants: ComponentStory<typeof TextField> = () => {
<Flex direction="column" gap={3}>
<TextField />
<TextField variant="ghost" />
+ <TextField variant="active" />
+ <TextField type="button" variant="active" />
</Flex>
);
};
diff --git a/packages/design-system/src/components/text-field.tsx b/packages/design-system/src/components/text-field.tsx
index 239f4ed334..7170b59785 100644
--- a/packages/design-system/src/components/text-field.tsx
+++ b/packages/design-system/src/components/text-field.tsx
@@ -146,6 +146,11 @@ const TextFieldBase = styled("div", {
backgroundColor: "transparent",
},
},
+ active: {
+ boxShadow:
+ "inset 0px 0px 0px 1px $colors$primary, 0px 0px 0px 1px $colors$primary",
+ ...getButtonSuffixCssVars("focus"),
+ },
},
state: {
invalid: {
@@ -173,13 +178,6 @@ const TextFieldBase = styled("div", {
paddingRight: 2,
},
},
- active: {
- true: {
- boxShadow:
- "inset 0px 0px 0px 1px $colors$primary, 0px 0px 0px 1px $colors$primary",
- ...getButtonSuffixCssVars("focus"),
- },
- },
},
});
@@ -191,7 +189,6 @@ export type TextFieldProps = Pick<
inputRef?: React.Ref<HTMLInputElement>;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
- active?: boolean;
};
export const TextField = React.forwardRef<HTMLDivElement, TextFieldProps>(
@@ -207,7 +204,6 @@ export const TextField = React.forwardRef<HTMLDivElement, TextFieldProps>(
onBlur,
onClick,
type,
- active = false,
// prevent spreading it into the dom
suffix: _suffix,
...textFieldProps
@@ -249,7 +245,6 @@ export const TextField = React.forwardRef<HTMLDivElement, TextFieldProps>(
withPrefix={Boolean(prefix)}
withSuffix={Boolean(suffix)}
onClickCapture={focusInnerInput}
- active={active}
>
{/* We want input to be the first element in DOM so it receives the focus first */}
<InputBase