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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Refactor to use new TextField
Andrey Okonetchnikov64ef11cf9b6d
diff --git a/apps/designer/app/auth/login.tsx b/apps/designer/app/auth/login.tsxindex 476776ebf6..8172ed3d86 100644--- a/apps/designer/app/auth/login.tsx+++ b/apps/designer/app/auth/login.tsx@@ -3,9 +3,11 @@ import { Form, useLoaderData } from "@remix-run/react";import { useState } from "react";import {+ Box,Card,Flex,Heading,+ Button,__DEPRECATED__Text,TextField,} from "@webstudio-is/design-system";@@ -44,59 +46,73 @@ export const Login = ({ errorMessage }: { errorMessage: string }) => {justify="center"><Card size={2}>- <Flex direction="column" gap="4" align="center">+ <Flex direction="column" align="center" gap="3"><Heading size="2">Login</Heading>- {errorMessage.length ? (- <__DEPRECATED__Text css={{ textAlign: "center" }} variant="red">- {errorMessage}- </__DEPRECATED__Text>- ) : null}- <Flex gap="2" direction="column" align="center">- <Form action="/auth/github" method="post">- <LoginButton enabled={data.isGithubEnabled}>- <Flex gap="1">- <GithubIcon width="20" />- Login with GitHub- </Flex>- </LoginButton>- </Form>- <Form action="/auth/google" method="post">- <LoginButton enabled={data.isGoogleEnabled}>- <Flex gap="1">- <GoogleIcon width="20" />- Login with Google- </Flex>- </LoginButton>- </Form>- {data.isDevLogin && (- <>- {isDevLoginOpen ? (- <Form action="/auth/dev" method="post">+ <Flex direction="column" gap="4" css={{ width: 300 }}>+ {errorMessage.length ? (+ <__DEPRECATED__Text css={{ textAlign: "center" }} variant="red">+ {errorMessage}+ </__DEPRECATED__Text>+ ) : null}+ <Flex gap="2" direction="column">+ <Form action="/auth/github" method="post">+ <LoginButton enabled={data.isGithubEnabled}>+ <Flex gap="2" align="center">+ <Flex css={{ width: 20, height: 20 }}>+ <GithubIcon />+ </Flex>+ Login with GitHub+ </Flex>+ </LoginButton>+ </Form>+ <Form action="/auth/google" method="post">+ <LoginButton enabled={data.isGoogleEnabled}>+ <Flex gap="2" align="center">+ <Flex css={{ width: 20, height: 20 }}>+ <GoogleIcon />+ </Flex>+ Login with Google+ </Flex>+ </LoginButton>+ </Form>+ {data.isDevLogin &&+ (isDevLoginOpen ? (+ <Flex+ as="form"+ action="/auth/dev"+ method="post"+ css={{+ flexDirection: "row",+ gap: "$2",+ }}+ ><TextFieldsize={2}- css={{ width: "100%", flexGrow: 1 }}name="secret"type="text"minLength={2}requiredautoFocus- placeholder="Place your auth secret here"+ placeholder="Auth secret"+ css={{ flexGrow: 1 }}/>- </Form>+ <Button size={2}>Login</Button>+ </Flex>) : (<LoginButtonenabled={data.isDevLogin}isDevLoginonClick={() => openDevLogin(true)}>- <Flex gap="1" align="center">- <CommitIcon width="20" />+ <Flex gap="2" align="center">+ <Flex css={{ width: 20, height: 20 }}>+ <CommitIcon />+ </Flex>Dev Login</Flex></LoginButton>- )}- </>- )}+ ))}+ </Flex></Flex></Flex></Card>diff --git a/apps/designer/app/designer/features/props-panel/control.tsx b/apps/designer/app/designer/features/props-panel/control.tsxindex 9f4ccc9128..f7259a08c6 100644--- a/apps/designer/app/designer/features/props-panel/control.tsx+++ b/apps/designer/app/designer/features/props-panel/control.tsx@@ -31,7 +31,6 @@ const TextControl = ({}: TextControlProps) => (<TextFieldtype={type}- variant="ghost"placeholder="Value"name="value"value={String(value || defaultValue || "")}diff --git a/apps/designer/app/designer/features/props-panel/props-panel.tsx b/apps/designer/app/designer/features/props-panel/props-panel.tsxindex 90fbe0446c..e280dfb805 100644--- a/apps/designer/app/designer/features/props-panel/props-panel.tsx+++ b/apps/designer/app/designer/features/props-panel/props-panel.tsx@@ -9,6 +9,7 @@ import { CollapsibleSection, ComponentInfo } from "~/designer/shared/inspector";import type { SelectedInstanceData } from "~/shared/canvas-components";import {Box,+ Flex,Button,Combobox,ComboboxTextField,@@ -41,6 +42,7 @@ const Property = ({const meta = componentsMeta[component];const argType = meta.argTypes?.[prop as keyof typeof meta.argTypes];const isInvalidProp =+ prop != null &&prop.length > 0 &&typeof argType === "undefined" &&!prop.match(/^data-(.)+/);@@ -51,11 +53,12 @@ const Property = ({return (<Grid- gap="1"+ gap={1}css={{ gridTemplateColumns: "1fr 1fr auto", alignItems: "center" }}><Comboboxname="prop"+ placeholder="Property"items={allProps}value={prop}itemToString={(item) => item ?? ""}@@ -68,7 +71,7 @@ const Property = ({inputProps={{...inputProps,readOnly: required,- placeholder: "Property",+ state: isInvalidProp ? "invalid" : undefined,}}/>)}@@ -76,6 +79,7 @@ const Property = ({<ComboboxPopperContent {...props} align="start" sideOffset={5} />)}/>+{isInvalidProp ? (<Tooltip content={`Invalid property name: ${prop}`}><ExclamationTriangleIcon width={12} height={12} />diff --git a/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx b/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsxindex d81672f355..e5674aba13 100644--- a/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx@@ -9,7 +9,6 @@ import {PopoverContent,PopoverPortal,TextField,- Tooltip,css,} from "@webstudio-is/design-system";import { PropertyName } from "../../shared/property-name";@@ -54,73 +53,56 @@ const ColorPicker = ({onChange,onChangeComplete,id,- styleConfig,}: ColorPickerProps) => {const [displayColorPicker, setDisplayColorPicker] = useState(false);// Color picker will use 0 as alpha value, which will force user to set alpha every time they have to change from transparentif (value === "transparent") value = "";return (- <Popover- modal- open={displayColorPicker}- onOpenChange={setDisplayColorPicker}- >- <PopoverTrigger asChild aria-label="Open color picker">- <Grid- css={{- gridTemplateColumns: "$sizes$6 auto",- gridTemplateRows: "repeat(1, 1fr)",- }}+ <TextField+ onChange={(e) => onChange(e.target.value)}+ value={value}+ id={id}+ prefix={+ <Popover+ modal+ open={displayColorPicker}+ onOpenChange={setDisplayColorPicker}>- <Tooltip- content={styleConfig.label}- delayDuration={700 / 4}- disableHoverableContent={true}+ <PopoverTrigger+ asChild+ aria-label="Open color picker"+ onClick={() => setDisplayColorPicker((shown) => !shown)}><Boxcss={{- gridArea: "1 / 1 / 2 / 2",- width: "calc($sizes$6 - 6px)",- height: "calc($sizes$6 - 6px)",- margin: 3,+ width: "$sizes$3",+ height: "$sizes$3",borderRadius: 2,background: value,- zIndex: 0,}}/>- </Tooltip>- <TextField- css={{- height: "$6",- gridArea: "1 / 1 / -1 / -1",- paddingLeft: "calc($sizes$6 + 6px)",- }}- onChange={(e) => onChange(e.target.value)}- onClick={() => setDisplayColorPicker((shown) => !shown)}- value={value}- id={id}- />- </Grid>- </PopoverTrigger>- <PopoverPortal>- <PopoverContent>- <SketchPicker- color={value}- onChange={(color: ColorResult) =>- onChange(stringifyRGBA(color.rgb))- }- onChangeComplete={(color: ColorResult) => {- onChangeComplete(stringifyRGBA(color.rgb));- }}- // @todo to remove both when we have preset colors- presetColors={[]}- className={pickerStyle()}- styles={defaultPickerStyles}- />- </PopoverContent>- </PopoverPortal>- </Popover>+ </PopoverTrigger>+ <PopoverPortal>+ <PopoverContent>+ <SketchPicker+ color={value}+ onChange={(color: ColorResult) =>+ onChange(stringifyRGBA(color.rgb))+ }+ onChangeComplete={(color: ColorResult) => {+ onChangeComplete(stringifyRGBA(color.rgb));+ }}+ // @todo to remove both when we have preset colors+ presetColors={[]}+ className={pickerStyle()}+ styles={defaultPickerStyles}+ />+ </PopoverContent>+ </PopoverPortal>+ </Popover>+ }+ />);};