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.

Make css value suffix optional and preventable (#1699)

Oleg Isonend52b49164819
diff --git a/apps/builder/app/builder/features/style-panel/shared/color-picker.tsx b/apps/builder/app/builder/features/style-panel/shared/color-picker.tsx
index e3ae86ed60..60bd3ed466 100644
--- a/apps/builder/app/builder/features/style-panel/shared/color-picker.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/color-picker.tsx
@@ -294,6 +294,7 @@ export const ColorPicker = ({
<CssValueInput
styleSource={styleSource}
prefix={prefix}
+ showSuffix={false}
property={property}
value={value}
intermediateValue={intermediateValue}
diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
index 8bd9cd6fb9..e8442f3414 100644
--- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -257,6 +257,7 @@ type CssValueInputProps = {
onAbort: () => void;
icon?: ReactNode;
prefix?: ReactNode;
+ showSuffix?: boolean;
};
const initialValue: IntermediateStyleValue = {
@@ -317,6 +318,7 @@ const match = <Item,>(
export const CssValueInput = ({
icon,
prefix,
+ showSuffix = true,
styleSource,
property,
keywords = [],
@@ -574,15 +576,16 @@ export const CssValueInput = ({
const isKeywordValue = value.type === "keyword" && hasItems;
const suffixRef = useRef<HTMLDivElement | null>(null);
- const suffix = (
- <Box ref={suffixRef}>
- {isUnitValue
- ? unitSelectElement
- : isKeywordValue
- ? keywordButtonElement
- : null}
- </Box>
- );
+ const suffix =
+ showSuffix === false ? null : (
+ <Box ref={suffixRef}>
+ {isUnitValue
+ ? unitSelectElement
+ : isKeywordValue
+ ? keywordButtonElement
+ : null}
+ </Box>
+ );
return (
<Combobox>