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.

Fixes borders, migrates deprecated components (#1471)

Oleg Isonen3ee1e35667e9
diff --git a/apps/builder/app/builder/builder.tsx b/apps/builder/app/builder/builder.tsx
index 4b9564f3ac..aef5fb64a0 100644
--- a/apps/builder/app/builder/builder.tsx
+++ b/apps/builder/app/builder/builder.tsx
@@ -226,7 +226,7 @@ const NavigatorPanel = ({
<SidePanel gridArea="navigator" isPreviewMode={isPreviewMode}>
<Box
css={{
- borderRight: `1px solid ${theme.colors.slate7}`,
+ borderRight: `1px solid ${theme.colors.borderMain}`,
width: theme.spacing[30],
height: "100%",
}}
diff --git a/apps/builder/app/builder/features/props-panel/props-panel.tsx b/apps/builder/app/builder/features/props-panel/props-panel.tsx
index 62dd231187..484d91e3c6 100644
--- a/apps/builder/app/builder/features/props-panel/props-panel.tsx
+++ b/apps/builder/app/builder/features/props-panel/props-panel.tsx
@@ -8,13 +8,13 @@ import {
ComboboxAnchor,
ComboboxListbox,
ComboboxListboxItem,
- DeprecatedTextField,
SmallIconButton,
Separator,
Flex,
Text,
type CSS,
ScrollArea,
+ InputField,
} from "@webstudio-is/design-system";
import { ChevronDownIcon } from "@webstudio-is/icons";
import type { Publish } from "~/shared/pubsub";
@@ -88,13 +88,14 @@ const PropsCombobox = ({
<Combobox>
<div {...combobox.getComboboxProps()}>
<ComboboxAnchor>
- <DeprecatedTextField
+ <InputField
autoFocus
{...combobox.getInputProps()}
placeholder="Property"
suffix={
<SmallIconButton
{...combobox.getToggleButtonProps()}
+ css={{ display: "flex", justifyContent: "center" }}
icon={<ChevronDownIcon />}
/>
}
diff --git a/apps/builder/app/builder/features/settings-panel/settings-panel.tsx b/apps/builder/app/builder/features/settings-panel/settings-panel.tsx
index 8dc15372df..0fba576c25 100644
--- a/apps/builder/app/builder/features/settings-panel/settings-panel.tsx
+++ b/apps/builder/app/builder/features/settings-panel/settings-panel.tsx
@@ -2,9 +2,9 @@ import { useStore } from "@nanostores/react";
import {
Flex,
Label,
- DeprecatedTextField,
theme,
ScrollArea,
+ InputField,
} from "@webstudio-is/design-system";
import { getComponentMeta } from "@webstudio-is/react-sdk";
import { selectedInstanceStore } from "~/shared/nano-states";
@@ -21,7 +21,7 @@ export const SettingsPanel = () => {
<ScrollArea css={{ px: theme.spacing[9] }}>
<Flex gap="1" direction="column" grow>
<Label>Instance Name</Label>
- <DeprecatedTextField
+ <InputField
/* Key is required, otherwise when label is undefined, previous value stayed */
key={selectedInstance.id}
onBlur={handleBlur}
diff --git a/apps/builder/app/builder/features/sidebar-left/panels/pages/settings.tsx b/apps/builder/app/builder/features/sidebar-left/panels/pages/settings.tsx
index e76cb55cba..4e86613c4e 100644
--- a/apps/builder/app/builder/features/sidebar-left/panels/pages/settings.tsx
+++ b/apps/builder/app/builder/features/sidebar-left/panels/pages/settings.tsx
@@ -1,6 +1,11 @@
import { z } from "zod";
import store from "immerhin";
-import { useState, useCallback, type ComponentProps } from "react";
+import {
+ useState,
+ useCallback,
+ type ComponentProps,
+ type FocusEventHandler,
+} from "react";
import { useStore } from "@nanostores/react";
import { useDebouncedCallback } from "use-debounce";
import { useUnmount } from "react-use";
@@ -18,13 +23,13 @@ import {
theme,
Button,
Box,
- DeprecatedLabel,
+ Label,
TextArea,
- DeprecatedTextField,
styled,
Flex,
InputErrorsTooltip,
Tooltip,
+ InputField,
} from "@webstudio-is/design-system";
import { ChevronDoubleLeftIcon, TrashIcon } from "@webstudio-is/icons";
import { useIds } from "~/shared/form-utils";
@@ -119,7 +124,7 @@ const toFormPage = (page?: Page): Values => {
};
};
-const autoSelectHandler = (event: React.FocusEvent<HTMLInputElement>) =>
+const autoSelectHandler: FocusEventHandler<HTMLInputElement> = (event) =>
event.target.select();
const FormFields = ({
@@ -145,11 +150,11 @@ const FormFields = ({
return (
<>
<Group>
- <DeprecatedLabel htmlFor={fieldIds.name}>Page Name</DeprecatedLabel>
+ <Label htmlFor={fieldIds.name}>Page Name</Label>
<InputErrorsTooltip errors={errors.name}>
- <DeprecatedTextField
+ <InputField
tabIndex={1}
- state={errors.name && "invalid"}
+ color={errors.name && "error"}
id={fieldIds.name}
autoFocus
onFocus={autoSelect ? autoSelectHandler : undefined}
@@ -165,11 +170,11 @@ const FormFields = ({
</Group>
{isHomePage !== true && (
<Group>
- <DeprecatedLabel htmlFor={fieldIds.path}>Path</DeprecatedLabel>
+ <Label htmlFor={fieldIds.path}>Path</Label>
<InputErrorsTooltip errors={errors.path}>
- <DeprecatedTextField
+ <InputField
tabIndex={1}
- state={errors.path && "invalid"}
+ color={errors.path && "error"}
id={fieldIds.path}
name="path"
placeholder="/about"
@@ -183,11 +188,11 @@ const FormFields = ({
</Group>
)}
<Group>
- <DeprecatedLabel htmlFor={fieldIds.title}>Title</DeprecatedLabel>
+ <Label htmlFor={fieldIds.title}>Title</Label>
<InputErrorsTooltip errors={errors.title}>
- <DeprecatedTextField
+ <InputField
tabIndex={1}
- state={errors.title && "invalid"}
+ color={errors.title && "error"}
id={fieldIds.title}
name="title"
placeholder="My awesome site - About"
@@ -200,9 +205,7 @@ const FormFields = ({
</InputErrorsTooltip>
</Group>
<Group>
- <DeprecatedLabel htmlFor={fieldIds.description}>
- Description
- </DeprecatedLabel>
+ <Label htmlFor={fieldIds.description}>Description</Label>
<InputErrorsTooltip errors={errors.description}>
<TextArea
tabIndex={1}
diff --git a/apps/builder/app/builder/features/style-panel/style-panel.tsx b/apps/builder/app/builder/features/style-panel/style-panel.tsx
index ed01a032b0..aaf791537d 100644
--- a/apps/builder/app/builder/features/style-panel/style-panel.tsx
+++ b/apps/builder/app/builder/features/style-panel/style-panel.tsx
@@ -1,4 +1,4 @@
-import { theme, Box, ScrollArea } from "@webstudio-is/design-system";
+import { theme, Box, ScrollArea, Separator } from "@webstudio-is/design-system";
import type { Instance } from "@webstudio-is/project-build";
import type { Publish } from "~/shared/pubsub";
@@ -34,6 +34,7 @@ export const StylePanel = ({ selectedInstance, publish }: StylePanelProps) => {
>
<StyleSourcesSection />
</Box>
+ <Separator />
<ScrollArea>
<StyleSettings
currentStyle={currentStyle}
diff --git a/apps/builder/app/builder/features/style-panel/style-source-section.tsx b/apps/builder/app/builder/features/style-panel/style-source-section.tsx
index fb0d8cfd3c..d5b2d86bac 100644
--- a/apps/builder/app/builder/features/style-panel/style-source-section.tsx
+++ b/apps/builder/app/builder/features/style-panel/style-source-section.tsx
@@ -1,7 +1,7 @@
import { useState } from "react";
import store from "immerhin";
import { nanoid } from "nanoid";
-import { theme, DeprecatedText2 } from "@webstudio-is/design-system";
+import { theme, Text } from "@webstudio-is/design-system";
import {
type Instance,
type StyleSource,
@@ -289,9 +289,9 @@ export const StyleSourcesSection = () => {
return (
<>
- <DeprecatedText2 css={{ py: theme.spacing[9] }} variant="label">
+ <Text css={{ py: theme.spacing[9] }} variant="titles">
Style Sources
- </DeprecatedText2>
+ </Text>
<StyleSourceInput
items={items}
diff --git a/apps/builder/app/builder/shared/collapsible-section.tsx b/apps/builder/app/builder/shared/collapsible-section.tsx
index 7d56b41273..5c13b28efa 100644
--- a/apps/builder/app/builder/shared/collapsible-section.tsx
+++ b/apps/builder/app/builder/shared/collapsible-section.tsx
@@ -1,12 +1,12 @@
import { atom } from "nanostores";
import { useStore } from "@nanostores/react";
import {
- Box,
Flex,
Collapsible,
SectionTitle,
SectionTitleLabel,
SectionTitleButton,
+ Separator,
} from "@webstudio-is/design-system";
import { theme } from "@webstudio-is/design-system";
import type { ComponentProps, ReactNode } from "react";
@@ -53,7 +53,7 @@ export const CollapsibleSectionBase = ({
onOpenChange,
}: CollapsibleSectionBaseProps) => (
<Collapsible.Root open={isOpen} onOpenChange={onOpenChange}>
- <Box css={{ boxShadow: `0px 1px 0 ${theme.colors.panelOutline}` }}>
+ <>
<Collapsible.Trigger asChild>
{trigger ?? (
<SectionTitle>
@@ -76,7 +76,8 @@ export const CollapsibleSectionBase = ({
{children}
</Flex>
</Collapsible.Content>
- </Box>
+ <Separator />
+ </>
</Collapsible.Root>
);
diff --git a/packages/design-system/src/components/input-field.tsx b/packages/design-system/src/components/input-field.tsx
index 01fe1018b4..c2bb883240 100644
--- a/packages/design-system/src/components/input-field.tsx
+++ b/packages/design-system/src/components/input-field.tsx
@@ -8,7 +8,7 @@ import {
type ReactNode,
type ComponentProps,
type Ref,
- type FocusEvent,
+ type FocusEventHandler,
} from "react";
import { textVariants } from "./text";
import { css, theme, type CSS } from "../stitches.config";
@@ -24,6 +24,7 @@ export const inputFieldTypes = [
"text",
"url",
"number",
+ "search",
] as const;
export const inputFieldColors = ["placeholder", "set", "error"] as const;
@@ -185,8 +186,8 @@ export const InputField = forwardRef(
suffix?: ReactNode;
containerRef?: Ref<HTMLDivElement>;
inputRef?: Ref<HTMLInputElement>;
- onFocus?: (e: FocusEvent) => void;
- onBlur?: (e: FocusEvent) => void;
+ onFocus?: FocusEventHandler;
+ onBlur?: FocusEventHandler;
},
ref: Ref<HTMLDivElement>
) => {
diff --git a/packages/design-system/src/components/search-field.tsx b/packages/design-system/src/components/search-field.tsx
index 3f60c8bba9..4c44209812 100644
--- a/packages/design-system/src/components/search-field.tsx
+++ b/packages/design-system/src/components/search-field.tsx
@@ -10,23 +10,23 @@ import {
CrossCircledFilledIcon,
MagnifyingGlassIcon,
} from "@webstudio-is/icons";
-import { DeprecatedTextField } from "./__DEPRECATED__/text-field";
-import { DeprecatedIconButton } from "./__DEPRECATED__/icon-button";
import { styled } from "../stitches.config";
import { theme } from "../stitches.config";
+import { InputField } from "./input-field";
+import { IconButton } from "./icon-button";
const SearchIcon = styled(MagnifyingGlassIcon, {
color: theme.colors.hint,
padding: theme.spacing[3],
});
-const AbortButton = styled(DeprecatedIconButton, {
+const AbortButton = styled(IconButton, {
marginRight: theme.spacing[3],
});
const SearchFieldBase: ForwardRefRenderFunction<
HTMLInputElement,
- ComponentProps<typeof DeprecatedTextField> & { onCancel?: () => void }
+ ComponentProps<typeof InputField> & { onCancel?: () => void }
> = (props, ref) => {
const {
onChange,
@@ -41,7 +41,7 @@ const SearchFieldBase: ForwardRefRenderFunction<
setValue(String(propsValue));
}, [propsValue]);
return (
- <DeprecatedTextField
+ <InputField
{...rest}
ref={ref}
type="search"
diff --git a/packages/design-system/src/components/sidebar-tabs.tsx b/packages/design-system/src/components/sidebar-tabs.tsx
index 37cdc4e929..2992f2485a 100644
--- a/packages/design-system/src/components/sidebar-tabs.tsx
+++ b/packages/design-system/src/components/sidebar-tabs.tsx
@@ -74,6 +74,6 @@ export const SidebarTabsContent = styled(TabsPrimitive.Content, {
bc: theme.colors.backgroundPanel,
outline: "none",
'&[data-state="active"]': {
- borderRight: `1px solid ${theme.colors.slate7}`,
+ borderRight: `1px solid ${theme.colors.borderMain}`,
},
});