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.

refactor icon button component

Oleg Isonen0ab7627fd0c2
diff --git a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
index 2495b20c27..b66d4c7e8f 100644
--- a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
+++ b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
@@ -134,8 +134,6 @@ export const TextControl = ({
onPointerUp={(event) => {
setValue((event.target as HTMLInputElement).value);
}}
- variant="ghost"
- size="1"
css={{
...iconButtonGridLeftStyle,
...(isCurrentBreakpoint && iconButtonActiveStyle),
diff --git a/packages/design-system/src/components/icon-button.tsx b/packages/design-system/src/components/icon-button.tsx
index 915b48b83d..fec2f9fd30 100644
--- a/packages/design-system/src/components/icon-button.tsx
+++ b/packages/design-system/src/components/icon-button.tsx
@@ -12,31 +12,22 @@ export const IconButton = styled("button", {
fontSize: "14px",
justifyContent: "center",
lineHeight: "1",
- outline: "none",
- padding: "0",
+ padding: 0,
textDecoration: "none",
userSelect: "none",
WebkitTapHighlightColor: "transparent",
color: "$hiContrast",
- "&::before": {
+ background: "none",
+ outline: "2px solid transparent",
+ outlineOffset: 2,
+ "&::before, &::after": {
boxSizing: "border-box",
},
- "&::after": {
- boxSizing: "border-box",
- },
- backgroundColor: "$loContrast",
- border: "1px solid $slate7",
- "@hover": {
- "&:hover": {
- borderColor: "$slate8",
- },
- },
- "&:active": {
- backgroundColor: "$slate2",
+ "&:hover, &:active": {
+ backgroundColor: "$slate5",
},
"&:focus": {
- borderColor: "$slate8",
- boxShadow: "0 0 0 1px $colors$slate8",
+ outlineColor: "$blue10",
},
"&:disabled": {
pointerEvents: "none",
@@ -47,94 +38,34 @@ export const IconButton = styled("button", {
variants: {
size: {
"1": {
- borderRadius: "$1",
+ borderRadius: 2,
height: "$5",
width: "$5",
},
"2": {
- borderRadius: "$2",
+ borderRadius: "$1",
height: "$6",
width: "$6",
},
"3": {
- borderRadius: "$2",
+ borderRadius: "$1",
height: "$7",
width: "$7",
},
"4": {
- borderRadius: "$3",
+ borderRadius: "$2",
height: "$8",
width: "$8",
},
},
- variant: {
- ghost: {
- backgroundColor: "transparent",
- borderWidth: "0",
- "@hover": {
- "&:hover": {
- backgroundColor: "$slateA3",
- },
- },
- "&:focus": {
- boxShadow:
- "inset 0 0 0 1px $colors$slateA8, 0 0 0 1px $colors$slateA8",
- },
- "&:active": {
- backgroundColor: "$slateA4",
- },
- '&[data-state="open"]': {
- backgroundColor: "$slateA4",
- },
- },
- raised: {
- boxShadow:
- "0 0 transparent, 0 16px 32px hsl(206deg 12% 5% / 25%), 0 3px 5px hsl(0deg 0% 0% / 10%)",
- "@hover": {
- "&:hover": {
- boxShadow:
- "0 0 transparent, 0 16px 32px hsl(206deg 12% 5% / 25%), 0 3px 5px hsl(0deg 0% 0% / 10%)",
- },
- },
- "&:focus": {
- borderColor: "$slate8",
- boxShadow:
- "0 0 0 1px $colors$slate8, 0 16px 32px hsl(206deg 12% 5% / 25%), 0 3px 5px hsl(0deg 0% 0% / 10%)",
- },
- "&:active": {
- backgroundColor: "$slate4",
- },
- },
- },
state: {
active: {
- backgroundColor: "$slate4",
- boxShadow: "inset 0 0 0 1px hsl(206,10%,76%)",
- "@hover": {
- "&:hover": {
- boxShadow: "inset 0 0 0 1px hsl(206,10%,76%)",
- },
- },
- "&:active": {
- backgroundColor: "$slate4",
- },
- },
- waiting: {
- backgroundColor: "$slate4",
- boxShadow: "inset 0 0 0 1px hsl(206,10%,76%)",
- "@hover": {
- "&:hover": {
- boxShadow: "inset 0 0 0 1px hsl(206,10%,76%)",
- },
- },
- "&:active": {
- backgroundColor: "$slate4",
- },
+ color: "$loContrast",
+ backgroundColor: "$blue10",
},
},
},
defaultVariants: {
size: "1",
- variant: "ghost",
},
});