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.

tweaks, fixes, etc, change style-panel lib/ source folder to shared/ lib is in .gitignore

Sultana730524763aa
diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsx
index 62a810eb8a..d9bc59107a 100644
--- a/apps/designer/app/designer/designer.tsx
+++ b/apps/designer/app/designer/designer.tsx
@@ -19,7 +19,7 @@ import {
} from "./shared/nano-states";
import { Topbar } from "./features/topbar";
import designerStyles from "./designer.css";
-import { Breadcrumbs } from "./features/footer";
+import { Footer } from "./features/footer";
import { TreePrevew } from "./features/tree-preview";
import {
useUpdateCanvasWidth,
@@ -144,7 +144,7 @@ const ChromeWrapper = ({ children, isPreviewMode }: ChromeWrapperProps) => {
`,
}
: {
- gridTemplateColumns: "auto 1fr 240px",
+ gridTemplateColumns: "auto 1fr $sizes$sidebarRight",
gridTemplateRows: "auto 1fr auto",
gridTemplateAreas: `
"header header header"
@@ -234,7 +234,7 @@ export const Designer = ({ config, project, assets }: DesignerProps) => {
>
{isDragging ? <TreePrevew /> : <Inspector publish={publish} />}
</SidePanel>
- <Breadcrumbs publish={publish} />
+ <Footer publish={publish} />
</ChromeWrapper>
</DndProvider>
);
diff --git a/apps/designer/app/designer/features/footer/breadcrumbs.tsx b/apps/designer/app/designer/features/footer/breadcrumbs.tsx
index ad4d78f8c1..f17d4673bf 100644
--- a/apps/designer/app/designer/features/footer/breadcrumbs.tsx
+++ b/apps/designer/app/designer/features/footer/breadcrumbs.tsx
@@ -1,40 +1,35 @@
import { ChevronRightIcon } from "@webstudio-is/icons";
-import { Button, Flex, Text, darkTheme } from "@webstudio-is/design-system";
+import { Button, Flex, Text } from "@webstudio-is/design-system";
import { useSelectedInstancePath } from "~/designer/shared/instance/use-selected-instance-path";
import { type Publish, type Instance } from "@webstudio-is/react-sdk";
import { useSelectedInstanceData } from "~/designer/shared/nano-states";
type BreadcrumbProps = {
component: Instance["component"];
- onClick: () => void;
+ onClick?: () => void;
};
const Breadcrumb = ({ component, onClick }: BreadcrumbProps) => {
return (
- <Flex
- align="center"
- css={{
- // @todo: this could be on the button itself, right?
- "& button": {
+ <>
+ <Button
+ ghost
+ onClick={onClick}
+ css={{
color: "$hiContrast",
- px: "0",
- },
- // @todo: and this on the svg, e.g. styled(Chevron...)(style)
- "& path": {
- fill: "$hiContrast",
- },
- }}
- >
- <Button ghost onClick={onClick}>
+ px: "$2",
+ borderRadius: "100vh",
+ height: "100%",
+ lineHeight: "100%",
+ }}
+ >
{component}
</Button>
- <ChevronRightIcon />
- </Flex>
+ <ChevronRightIcon color="white" />
+ </>
);
};
-const EmptyState = () => <Text size="1">No instance selected</Text>;
-
type BreadcrumbsProps = {
publish: Publish;
};
@@ -44,22 +39,9 @@ export const Breadcrumbs = ({ publish }: BreadcrumbsProps) => {
selectedInstanceData?.id
);
return (
- <Flex
- className={darkTheme}
- as="footer"
- align="center"
- css={{
- gridArea: "footer",
- height: "$5",
- background: "$loContrast",
- padding: "$2",
- "[data-theme=dark] &": {
- boxShadow: "inset 0 1px 0 0 $colors$gray7",
- },
- }}
- >
+ <Flex align="center" css={{ height: "100%" }}>
{selectedInstancePath.length === 0 ? (
- <EmptyState />
+ <Breadcrumb component={<Text size="1">No instance selected</Text>} />
) : (
selectedInstancePath.map((instance) => (
<Breadcrumb
diff --git a/apps/designer/app/designer/features/footer/footer.tsx b/apps/designer/app/designer/features/footer/footer.tsx
new file mode 100644
index 0000000000..29eea38c7d
--- /dev/null
+++ b/apps/designer/app/designer/features/footer/footer.tsx
@@ -0,0 +1,23 @@
+import { Box, Flex, darkTheme } from "@webstudio-is/design-system";
+import { type Publish } from "@webstudio-is/react-sdk";
+import { Breadcrumbs } from "./breadcrumbs";
+
+export const Footer = ({ publish }: { publish: Publish }) => {
+ return (
+ <Flex
+ className={darkTheme}
+ as="footer"
+ align="center"
+ css={{
+ gridArea: "footer",
+ height: "$sizes$5",
+ background: "$loContrast",
+ boxShadow: "inset 0 1px 0 0 $colors$panelOutline",
+ }}
+ >
+ <Box css={{ height: "100%", p: "$sizes$1" }}>
+ <Breadcrumbs publish={publish} />
+ </Box>
+ </Flex>
+ );
+};
diff --git a/apps/designer/app/designer/features/footer/index.ts b/apps/designer/app/designer/features/footer/index.ts
index 669f557577..564d0ae429 100644
--- a/apps/designer/app/designer/features/footer/index.ts
+++ b/apps/designer/app/designer/features/footer/index.ts
@@ -1 +1,2 @@
export * from "./breadcrumbs";
+export * from "./footer";
diff --git a/apps/designer/app/designer/features/style-panel/lib/color-picker.tsx b/apps/designer/app/designer/features/style-panel/shared/color-picker.tsx
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/color-picker.tsx
rename to apps/designer/app/designer/features/style-panel/shared/color-picker.tsx
diff --git a/apps/designer/app/designer/features/style-panel/lib/configs.ts b/apps/designer/app/designer/features/style-panel/shared/configs.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/configs.ts
rename to apps/designer/app/designer/features/style-panel/shared/configs.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/constants.ts b/apps/designer/app/designer/features/style-panel/shared/constants.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/constants.ts
rename to apps/designer/app/designer/features/style-panel/shared/constants.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/dependencies.ts b/apps/designer/app/designer/features/style-panel/shared/dependencies.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/dependencies.ts
rename to apps/designer/app/designer/features/style-panel/shared/dependencies.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/get-css-rule-for-breakpoint.ts b/apps/designer/app/designer/features/style-panel/shared/get-css-rule-for-breakpoint.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/get-css-rule-for-breakpoint.ts
rename to apps/designer/app/designer/features/style-panel/shared/get-css-rule-for-breakpoint.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/get-inherited-style.ts b/apps/designer/app/designer/features/style-panel/shared/get-inherited-style.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/get-inherited-style.ts
rename to apps/designer/app/designer/features/style-panel/shared/get-inherited-style.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/parse-css-value.test.ts b/apps/designer/app/designer/features/style-panel/shared/parse-css-value.test.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/parse-css-value.test.ts
rename to apps/designer/app/designer/features/style-panel/shared/parse-css-value.test.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/parse-css-value.ts b/apps/designer/app/designer/features/style-panel/shared/parse-css-value.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/parse-css-value.ts
rename to apps/designer/app/designer/features/style-panel/shared/parse-css-value.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/spacing-widget.tsx b/apps/designer/app/designer/features/style-panel/shared/spacing-widget.tsx
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/spacing-widget.tsx
rename to apps/designer/app/designer/features/style-panel/shared/spacing-widget.tsx
diff --git a/apps/designer/app/designer/features/style-panel/lib/use-is-from-current-breakpoint.ts b/apps/designer/app/designer/features/style-panel/shared/use-is-from-current-breakpoint.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/use-is-from-current-breakpoint.ts
rename to apps/designer/app/designer/features/style-panel/shared/use-is-from-current-breakpoint.ts
diff --git a/apps/designer/app/designer/features/style-panel/lib/use-style-data.ts b/apps/designer/app/designer/features/style-panel/shared/use-style-data.ts
similarity index 100%
rename from apps/designer/app/designer/features/style-panel/lib/use-style-data.ts
rename to apps/designer/app/designer/features/style-panel/shared/use-style-data.ts
diff --git a/apps/designer/app/designer/features/style-panel/style-panel.tsx b/apps/designer/app/designer/features/style-panel/style-panel.tsx
index 33700f698e..4291348f6d 100644
--- a/apps/designer/app/designer/features/style-panel/style-panel.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-panel.tsx
@@ -2,7 +2,7 @@ import type { Publish } from "@webstudio-is/react-sdk";
import { willRender } from "~/designer/shared/breakpoints";
import { Box, Card, Paragraph } from "@webstudio-is/design-system";
import type { SelectedInstanceData } from "~/shared/canvas-components";
-import { useStyleData } from "./lib/use-style-data";
+import { useStyleData } from "./shared/use-style-data";
import { StyleSettings } from "./style-settings";
import { Search } from "./search";
import { useState } from "react";
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 8106f0c7c1..60e7d33184 100644
--- a/apps/designer/app/designer/features/style-panel/style-section.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-section.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useState, KeyboardEvent } from "react";
import {
Box,
Flex,
@@ -15,7 +15,7 @@ import {
} from "@webstudio-is/design-system";
import { TriangleRightIcon, TriangleDownIcon } from "@webstudio-is/icons";
import * as icons from "@webstudio-is/icons";
-import type { StyleConfig } from "./lib/configs";
+import type { StyleConfig } from "./shared/configs";
import {
categories,
type Style,
@@ -24,16 +24,16 @@ import {
type StyleValue,
type CSS,
} from "@webstudio-is/react-sdk";
-import type { SetProperty, CreateBatchUpdate } from "./lib/use-style-data";
-import type { InheritedStyle } from "./lib/get-inherited-style";
-import { ColorPicker } from "./lib/color-picker";
+import type { SetProperty, CreateBatchUpdate } from "./shared/use-style-data";
+import type { InheritedStyle } from "./shared/get-inherited-style";
+import { ColorPicker } from "./shared/color-picker";
import {
SpacingWidget,
type SpacingProperty,
type SpacingStyles,
-} from "./lib/spacing-widget";
-import { useIsFromCurrentBreakpoint } from "./lib/use-is-from-current-breakpoint";
-import { propertyNameColorForSelectedBreakpoint } from "./lib/constants";
+} from "./shared/spacing-widget";
+import { useIsFromCurrentBreakpoint } from "./shared/use-is-from-current-breakpoint";
+import { propertyNameColorForSelectedBreakpoint } from "./shared/constants";
const getFinalValue = ({
currentStyle,
@@ -203,6 +203,7 @@ const ComboboxControl = ({
switch (styleConfig.property) {
case "rowGap":
case "columnGap": {
+ console.log(currentStyle, styleConfig);
const Icon = (
icons as unknown as {
gap: Record<string, (props: unknown) => JSX.Element>;
@@ -244,7 +245,7 @@ const ComboboxControl = ({
defaultValue={parseFloat(String(value.value)) || 0}
// @todo looses input state and focus
// onChange={(event: ChangeEvent<HTMLInputElement>) => setValue(event.target.value + "px")
- onKeyDown={(event) =>
+ onKeyDown={(event: KeyboardEvent<HTMLInputElement>) =>
event.key === "Enter" &&
setValue(event.currentTarget.value + "px")
}
@@ -276,6 +277,7 @@ const ComboboxControl = ({
}}
state={value.type === "invalid" ? "invalid" : undefined}
value={String(value.value)}
+ // @todo new combobox doesn't include any of these event handlers
onValueSelect={setValue}
onValueEnter={setValue}
onItemEnter={(value) => {
@@ -390,12 +392,10 @@ const ComboiconControl = ({
const GridControl = ({
css,
currentStyle,
- setProperty,
createBatchUpdate,
}: {
css: CSS;
currentStyle: Style;
- setProperty: SetProperty;
createBatchUpdate: CreateBatchUpdate;
}) => {
const isCurrentBreakpoint = useIsFromCurrentBreakpoint([
@@ -562,7 +562,6 @@ const ShowMore = ({ styleConfigs }: { styleConfigs: Array<JSX.Element> }) => {
type RenderPropertyProps = {
setProperty: SetProperty;
- createBatchUpdate: CreateBatchUpdate;
currentStyle: Style;
inheritedStyle: InheritedStyle;
styleConfig: StyleConfig;
@@ -573,7 +572,6 @@ export const renderProperty = ({
currentStyle,
inheritedStyle,
setProperty,
- createBatchUpdate,
styleConfig,
category,
}: RenderPropertyProps) => {
@@ -645,7 +643,7 @@ export const renderCategory = ({
"${"grid ".repeat(5)} . . . . . . ."
"${"columnGap ".repeat(5)} lock lock ${"rowGap ".repeat(5)}"
`,
- // @todo justify icons are using justifycontent icons atm
+ // @todo justifyItems icons are using justifycontent icons atm
"& > [data-property=justifyItems]": {
display: "none",
},
@@ -662,7 +660,6 @@ export const renderCategory = ({
data-property="grid"
css={{ gridArea: "grid" }}
currentStyle={currentStyle}
- setProperty={setProperty}
createBatchUpdate={createBatchUpdate}
/>
</Grid>
diff --git a/apps/designer/app/designer/features/style-panel/style-settings.tsx b/apps/designer/app/designer/features/style-panel/style-settings.tsx
index f76796c7ae..78e1c22ffe 100644
--- a/apps/designer/app/designer/features/style-panel/style-settings.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-settings.tsx
@@ -6,12 +6,15 @@ import {
type Style,
} from "@webstudio-is/react-sdk";
-import { type StyleConfig, styleConfigs } from "./lib/configs";
+import { type StyleConfig, styleConfigs } from "./shared/configs";
import { CollapsibleSection } from "~/designer/shared/inspector";
import { renderProperty, renderCategory } from "./style-section";
-import { dependencies } from "./lib/dependencies";
-import { type InheritedStyle } from "./lib/get-inherited-style";
-import { type SetProperty, type CreateBatchUpdate } from "./lib/use-style-data";
+import { dependencies } from "./shared/dependencies";
+import { type InheritedStyle } from "./shared/get-inherited-style";
+import {
+ type SetProperty,
+ type CreateBatchUpdate,
+} from "./shared/use-style-data";
import { type SelectedInstanceData } from "~/shared/canvas-components";
// Finds a property/value by using any available form: property, label, value
diff --git a/packages/design-system/src/stitches.config.ts b/packages/design-system/src/stitches.config.ts
index 799caa4d04..e690c07725 100644
--- a/packages/design-system/src/stitches.config.ts
+++ b/packages/design-system/src/stitches.config.ts
@@ -231,6 +231,8 @@ export const {
7: "45px",
8: "65px",
9: "80px",
+ sidebarLeft: "45px",
+ sidebarRight: "240px",
},
// space: {
// 1: '4px',
diff --git a/packages/react-sdk/src/css/categories.ts b/packages/react-sdk/src/css/categories.ts
index 2b1e46467e..59fc14d144 100644
--- a/packages/react-sdk/src/css/categories.ts
+++ b/packages/react-sdk/src/css/categories.ts
@@ -89,7 +89,6 @@ const typography = [
"textIndent",
"columnCount",
- "columnGap",
"columnRuleStyle",
"columnRuleWidth",
"columnRuleColor",