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.

flex row/column gap inputs, add icons and touch up styles

Sultan9ac46088d829
diff --git a/apps/designer/app/designer/features/style-panel/style-section.tsx b/apps/designer/app/designer/features/style-panel/style-section.tsx
index c7b985af63..afef29417d 100644
--- a/apps/designer/app/designer/features/style-panel/style-section.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-section.tsx
@@ -185,6 +185,8 @@ const ComboboxControl = ({
setProperty,
styleConfig,
}: ControlProps) => {
+ const isCurrentBreakpoint = useIsFromCurrentBreakpoint(styleConfig.property);
+
if (styleConfig.control !== "Combobox") return null;
// @todo show which instance we inherited the value from
@@ -201,15 +203,55 @@ const ComboboxControl = ({
switch (styleConfig.property) {
case "rowGap":
case "columnGap": {
+ const Icon = (icons as any).gap[styleConfig.property];
return (
- <TextField
- type="number"
- value={parseFloat(String(value.value)) || 0}
- onChange={(event: ChangeEvent<HTMLInputElement>) =>
- setValue(event.target.value)
- }
- css={{ cursor: "default" }}
- />
+ <Grid
+ css={{
+ gridTemplateColumns: "repeat(4, 1fr)",
+ gridTemplateRows: "repeat(1, 1fr)",
+ }}
+ >
+ <IconButton
+ variant="ghost"
+ size="1"
+ css={{
+ zIndex: 1,
+ gridArea: "1 / 1 / 2 / 2",
+ marginLeft: 2,
+ marginTop: 2,
+ borderRadius: 1,
+ height: "calc($sizes$5 - 4px)",
+ width: "calc($sizes$5 - 4px)",
+ "&:focus": {
+ boxShadow: "none",
+ },
+ ...(isCurrentBreakpoint && {
+ bc: "$colors$blue4",
+ "& svg *": {
+ fill: "$colors$blue11",
+ },
+ }),
+ }}
+ >
+ <Icon />
+ </IconButton>
+ <TextField
+ type="number"
+ defaultValue={parseFloat(String(value.value)) || 0}
+ // @todo looses input state and focus
+ // onChange={(event: ChangeEvent<HTMLInputElement>) => setValue(event.target.value + "px")
+ onKeyDown={(event) =>
+ event.key === "Enter" &&
+ setValue(event.currentTarget.value + "px")
+ }
+ css={{
+ fontWeight: "500",
+ paddingLeft: "calc($5 + 6px)",
+ gridArea: "1 / 1 / -1 / -1",
+ cursor: "default",
+ }}
+ />
+ </Grid>
);
}
}
@@ -537,7 +579,7 @@ export const renderCategory = ({
"grid grid grid grid grid flexDirection flexDirection flexWrap flexWrap justifyItems justifyItems ."
"grid grid grid grid grid alignItems alignItems justifyContent justifyContent alignContent alignContent ."
"grid grid grid grid grid . . . . . . ."
- "rowGap rowGap rowGap rowGap rowGap lock lock columnGap columnGap columnGap columnGap columnGap"
+ "columnGap columnGap columnGap columnGap columnGap lock lock rowGap rowGap rowGap rowGap rowGap"
`,
gap: "8px",
"& > [data-type=comboicon]": {
diff --git a/apps/designer/app/shared/design-system/stitches.config.ts b/apps/designer/app/shared/design-system/stitches.config.ts
index 9f5d9140fa..7a681476d0 100644
--- a/apps/designer/app/shared/design-system/stitches.config.ts
+++ b/apps/designer/app/shared/design-system/stitches.config.ts
@@ -225,7 +225,7 @@ export const {
2: "10px",
3: "15px",
4: "20px",
- 5: "25px",
+ 5: "28px",
6: "35px",
7: "45px",
8: "65px",
diff --git a/apps/designer/app/shared/icons/gap.tsx b/apps/designer/app/shared/icons/gap.tsx
index a08339b9ba..fc20ca2306 100644
--- a/apps/designer/app/shared/icons/gap.tsx
+++ b/apps/designer/app/shared/icons/gap.tsx
@@ -12,7 +12,22 @@ export const RowGap = React.forwardRef<SVGSVGElement, IconProps>(
xmlns="http://www.w3.org/2000/svg"
{...props}
ref={forwardedRef}
- ></svg>
+ style={{ transform: "rotate(90deg)" }}
+ >
+ <path
+ d="M14.4704 6H13.4407L13.4407 18L14.4704 18L14.4704 6Z"
+ fill="#11181C"
+ />
+ <path d="M14.4704 6H17.5593V7H14.4704L14.4704 6Z" fill="#11181C" />
+ <path
+ d="M14.4704 17L17.5593 17V18L14.4704 18L14.4704 17Z"
+ fill="#11181C"
+ />
+ <path
+ d="M6.44074 6L10.5296 6L10.5296 18L6.44073 18L6.44073 17L9.5 17L9.5 7L6.44074 7L6.44074 6Z"
+ fill="#11181C"
+ />
+ </svg>
);
}
);
@@ -29,13 +44,29 @@ export const ColumnGap = React.forwardRef<SVGSVGElement, IconProps>(
xmlns="http://www.w3.org/2000/svg"
{...props}
ref={forwardedRef}
- ></svg>
+ >
+ <path
+ d="M14.4704 6H13.4407L13.4407 18L14.4704 18L14.4704 6Z"
+ fill="#11181C"
+ />
+ <path d="M14.4704 6H17.5593V7H14.4704L14.4704 6Z" fill="#11181C" />
+ <path
+ d="M14.4704 17L17.5593 17V18L14.4704 18L14.4704 17Z"
+ fill="#11181C"
+ />
+ <path
+ d="M6.44074 6L10.5296 6L10.5296 18L6.44073 18L6.44073 17L9.5 17L9.5 7L6.44074 7L6.44074 6Z"
+ fill="#11181C"
+ />
+ </svg>
);
}
);
ColumnGap.displayName = "ColumnGap";
export const gap = {
+ rowGap: RowGap,
+ columnGap: ColumnGap,
"row-gap": RowGap,
"column-gap": ColumnGap,
};