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.

css-property > css-vaule

Oleg Isonenda919d96e5f1
diff --git a/apps/designer/app/designer/features/props-panel/props-panel.tsx b/apps/designer/app/designer/features/props-panel/props-panel.tsx
index 831b7f3927..084a501d25 100644
--- a/apps/designer/app/designer/features/props-panel/props-panel.tsx
+++ b/apps/designer/app/designer/features/props-panel/props-panel.tsx
@@ -139,7 +139,6 @@ const Property = ({
<Combobox
items={allProps}
value={prop}
- itemToString={(item) => item ?? ""}
onItemSelect={(value: PropertyProps["value"] | null) => {
if (value !== null) {
onChange(id, "prop", value);
diff --git a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
index c0fb4d7605..179b023dc8 100644
--- a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
+++ b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
@@ -1,4 +1,4 @@
-import { CssPropertyControl } from "~/designer/features/style-panel/controls/css-property/css-property";
+import { CssValueInput } from "~/designer/features/style-panel/controls/css-property/css-property";
import { getFinalValue } from "../../shared/get-final-value";
import { ControlProps } from "../../style-sections";
import { StyleValue } from "@webstudio-is/react-sdk";
@@ -32,7 +32,7 @@ export const TextControl = ({
};
return (
- <CssPropertyControl
+ <CssValueInput
property={styleConfig.property}
value={value}
allowedValues={styleConfig.items.map((item) => ({
diff --git a/apps/designer/app/designer/features/style-panel/controls/css-property/css-property.stories.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsx
similarity index 94%
rename from apps/designer/app/designer/features/style-panel/controls/css-property/css-property.stories.tsx
rename to apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsx
index dfc03c6590..1582a36476 100644
--- a/apps/designer/app/designer/features/style-panel/controls/css-property/css-property.stories.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsx
@@ -1,10 +1,10 @@
import React from "react";
import { Flex, TextField } from "@webstudio-is/design-system";
import { StyleValue } from "@webstudio-is/react-sdk";
-import { CssPropertyControl } from "./css-property";
+import { CssValueInput } from "./css-property";
export default {
- component: CssPropertyControl,
+ component: CssValueInput,
};
export const WithKeywords = () => {
@@ -14,7 +14,7 @@ export const WithKeywords = () => {
});
return (
- <CssPropertyControl
+ <CssValueInput
property="width"
value={value}
allowedValues={[
@@ -43,7 +43,7 @@ export const WithIcons = () => {
});
return (
- <CssPropertyControl
+ <CssValueInput
property="alignItems"
value={value}
allowedValues={[
@@ -78,7 +78,7 @@ export const WithUnits = () => {
return (
<Flex css={{ gap: "$3" }}>
- <CssPropertyControl
+ <CssValueInput
property="rowGap"
value={value}
allowedValues={[
diff --git a/apps/designer/app/designer/features/style-panel/controls/css-property/css-property.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
similarity index 98%
rename from apps/designer/app/designer/features/style-panel/controls/css-property/css-property.tsx
rename to apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
index 1cfde8fa8d..b2f6169ccf 100644
--- a/apps/designer/app/designer/features/style-panel/controls/css-property/css-property.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -32,7 +32,7 @@ const sortedUnits = units
: 1
);
-type CssPropertyControlProps = {
+type CssValueInputProps = {
property: StyleProperty;
value?: StyleValue;
allowedValues?: Array<KeywordValue>;
@@ -40,13 +40,13 @@ type CssPropertyControlProps = {
onChangeComplete?: (value?: StyleValue) => void;
};
-export const CssPropertyControl = ({
+export const CssValueInput = ({
property,
value,
allowedValues = [],
onChange,
onChangeComplete,
-}: CssPropertyControlProps) => {
+}: CssValueInputProps) => {
const inputRef = useRef<HTMLInputElement | null>(null);
const handleArrowUpDown = (event: KeyboardEvent<HTMLInputElement>) => {