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.

feat: Suggest a variable when user forgets -- in advanced panel (#4850)

Oleg Isonenb68d29bbca74
diff --git a/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx b/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx
index 6534e6b099..55e75d40f9 100644
--- a/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx
@@ -137,6 +137,13 @@ const matchOrSuggestToCreate = (
label: `Create "${propertyName}"`,
});
}
+ // When there is no match we suggest to create a custom property.
+ if (matched.length === 0) {
+ matched.unshift({
+ value: `--${propertyName}`,
+ label: `--${propertyName}`,
+ });
+ }
return matched;
};
@@ -257,8 +264,15 @@ const AddProperty = forwardRef<
<ComboboxListboxItem
{...combobox.getItemProps({ item, index })}
key={index}
+ asChild
>
- {item.label}
+ <Text
+ variant="labelsSentenceCase"
+ truncate
+ css={{ maxWidth: "25ch" }}
+ >
+ {item.label}
+ </Text>
</ComboboxListboxItem>
))}
</ComboboxScrollArea>
diff --git a/packages/design-system/src/utilities.ts b/packages/design-system/src/utilities.ts
index 26d237fcec..a82cb6be29 100644
--- a/packages/design-system/src/utilities.ts
+++ b/packages/design-system/src/utilities.ts
@@ -145,5 +145,5 @@ export const useResize = ({
export const truncate = (): CSS => ({
whiteSpace: "nowrap",
textOverflow: "ellipsis",
- overflow: "hidden",
+ overflow: "clip",
});