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
typography section wip
Sultan1cdd63fc1a3f
diff --git a/apps/designer/app/designer/features/style-panel/sections/layout/shared/lock.tsx b/apps/designer/app/designer/features/style-panel/sections/layout/shared/lock.tsxindex f1754c79cc..f61b2619bc 100644--- a/apps/designer/app/designer/features/style-panel/sections/layout/shared/lock.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/layout/shared/lock.tsx@@ -43,7 +43,10 @@ export const Lock = ({justifyContent: "center",}}>- <IconButton onClick={() => setIsPaired((value) => !value)}>+ <IconButton+ onClick={() => setIsPaired((value) => !value)}+ css={{ width: "100%" }}+ >{isPaired ? <LockCloseIcon /> : <LockOpenIcon />}</IconButton></Flex>diff --git a/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsx b/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsxindex a71078d2ec..5eb073cde3 100644--- a/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsx@@ -1,19 +1,193 @@import type { RenderCategoryProps } from "../../style-sections";-import { ShowMore } from "../../shared/show-more";-import { renderProperty } from "../../style-sections";+import { Grid, IconButton } from "@webstudio-is/design-system";+import { PropertyName } from "../../shared/property-name";+import {+ ColorControl,+ FontFamilyControl,+ SelectControl,+ TextControl,+} from "../../controls";+import { CrossSmallIcon, EllipsesIcon } from "@webstudio-is/icons";+import { ToggleGroupControl } from "../../controls/toggle/toggle-control";export const TypographySection = ({- styleConfigsByCategory,- moreStyleConfigsByCategory,+ setProperty,+ currentStyle,+ sectionStyle,}: RenderCategoryProps) => {+ const setTextAlign = setProperty("textAlign");+ const setTextDecorationLine = setProperty("textDecorationLine");+ const setTextTransform = setProperty("textTransform");+ const setFontStyle = setProperty("fontStyle");+return (<>- {styleConfigsByCategory.map((entry) => renderProperty(entry))}- <ShowMore- styleConfigs={moreStyleConfigsByCategory.map((entry) =>- renderProperty(entry)- )}- />+ <Grid gap="2">+ <Grid css={{ gridTemplateColumns: "4fr 6fr" }}>+ <PropertyName+ label="Font"+ property={sectionStyle.fontFamily?.styleConfig.property}+ />+ <FontFamilyControl {...sectionStyle.fontFamily} />+ </Grid>+ <Grid css={{ gridTemplateColumns: "4fr 6fr" }}>+ <PropertyName+ label="Weight"+ property={sectionStyle.fontWeight?.styleConfig.property}+ />+ <SelectControl {...sectionStyle.fontWeight} />+ </Grid>+ <Grid css={{ gridTemplateColumns: "4fr 6fr" }}>+ <PropertyName+ label="Color"+ property={sectionStyle.color?.styleConfig.property}+ />+ <ColorControl {...sectionStyle.color} />+ </Grid>+ </Grid>++ <Grid+ css={{+ gridTemplateColumns: "1fr 1fr 1fr",+ gap: "$3",+ }}+ >+ <Grid css={{ gridTemplateColumns: "auto", gap: "$1" }}>+ <PropertyName+ property={sectionStyle.fontSize?.styleConfig.property}+ label="Size"+ />+ <TextControl {...sectionStyle.fontSize} />+ </Grid>+ <Grid css={{ gridTemplateColumns: "auto", gap: "$1" }}>+ <PropertyName+ property={sectionStyle.lineHeight?.styleConfig.property}+ label="Height"+ />+ <TextControl {...sectionStyle.lineHeight} />+ </Grid>+ <Grid css={{ gridTemplateColumns: "auto", gap: "$1" }}>+ <PropertyName+ property={sectionStyle.letterSpacing?.styleConfig.property}+ label="Spacing"+ />+ <TextControl {...sectionStyle.letterSpacing} />+ </Grid>+ </Grid>++ <Grid gap="2">+ <Grid+ css={{+ gridTemplateColumns: "1fr 1fr",+ gap: "$3",+ }}+ >+ <ToggleGroupControl+ property={sectionStyle.textAlign?.styleConfig.property}+ onValueChange={(value) => setTextAlign(value)}+ value={String(currentStyle.alignSelf?.value)}+ items={[+ {+ child: <CrossSmallIcon />,+ label: "align: left",+ value: "left",+ },+ {+ child: <CrossSmallIcon />,+ label: "align: center",+ value: "center",+ },+ {+ child: <CrossSmallIcon />,+ label: "align: right",+ value: "right",+ },+ {+ child: <CrossSmallIcon />,+ label: "align: justify",+ value: "justify",+ },+ ]}+ />+ <ToggleGroupControl+ property={sectionStyle.textDecorationLine?.styleConfig.property}+ onValueChange={(value) => setTextDecorationLine(value)}+ value={String(currentStyle.textDecorationLine?.value)}+ items={[+ {+ child: <CrossSmallIcon />,+ label: "None",+ value: "none",+ },+ {+ child: <CrossSmallIcon />,+ label: "Underline",+ value: "underline",+ },+ {+ child: <CrossSmallIcon />,+ label: "Line through",+ value: "line-through",+ },+ ]}+ />+ </Grid>+ <Grid+ css={{+ gridTemplateColumns: "1fr 1fr auto",+ gap: "$3",+ alignItems: "center",+ }}+ >+ <ToggleGroupControl+ property={sectionStyle.textTransform?.styleConfig.property}+ onValueChange={(value) => setTextTransform(value)}+ value={String(currentStyle.textTransform?.value)}+ items={[+ {+ child: <CrossSmallIcon />,+ label: "None",+ value: "none",+ },+ {+ child: <CrossSmallIcon />,+ label: "Uppercase",+ value: "uppercase",+ },+ {+ child: <CrossSmallIcon />,+ label: "Capitalize",+ value: "capitalize",+ },+ {+ child: <CrossSmallIcon />,+ label: "Lowercase",+ value: "lowercase",+ },+ ]}+ />+ <ToggleGroupControl+ property={sectionStyle.fontStyle?.styleConfig.property}+ onValueChange={(value) => setFontStyle(value)}+ value={String(currentStyle.fontStyle?.value)}+ items={[+ {+ child: <CrossSmallIcon />,+ label: "None",+ value: "normal",+ },+ {+ child: <CrossSmallIcon />,+ label: "Italic",+ value: "italic",+ },+ ]}+ />+ <IconButton>+ <EllipsesIcon />+ </IconButton>+ </Grid>+ </Grid></>);};diff --git a/packages/design-system/src/components/icon-button.tsx b/packages/design-system/src/components/icon-button.tsxindex a2286a99d4..3134cde043 100644--- a/packages/design-system/src/components/icon-button.tsx+++ b/packages/design-system/src/components/icon-button.tsx@@ -42,22 +42,22 @@ export const IconButton = styled("button", {"1": {borderRadius: 2,height: "$5",- width: "min($5, 100%)",+ width: "$5",},"2": {borderRadius: "$1",height: "$6",- width: "min($6, 100%)",+ width: "$6",},"3": {borderRadius: "$1",height: "$7",- width: "min($7, 100%)",+ width: "$7",},"4": {borderRadius: "$2",height: "$8",- width: "min($8, 100%)",+ width: "$8",},},state: {