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
render icons
Oleg Isonenbfb021f018dd
diff --git a/app/designer/features/breakpoints/trigger-button.tsx b/app/designer/features/breakpoints/trigger-button.tsxindex 3a8d62843d..0c920bb132 100644--- a/app/designer/features/breakpoints/trigger-button.tsx+++ b/app/designer/features/breakpoints/trigger-button.tsx@@ -1,13 +1,38 @@import { forwardRef, type ComponentProps, type ElementRef } from "react";+import { type Breakpoint } from "@webstudio-is/sdk";import {useCanvasWidth,useScale,useSelectedBreakpoint,} from "~/designer/shared/nano-values";import { Button, Text } from "~/shared/design-system";+import {+ DesktopIcon,+ LaptopIcon,+ MobileIcon,+ TabletIcon,+ DevicesIcon,+} from "~/shared/icons";type TriggerButtonProps = ComponentProps<typeof Button>;+const renderIcon = (breakpoint: Breakpoint, variant: "contrast" | "gray") => {+ const color = variant === "contrast" ? "white" : "gray";+ if (breakpoint.minWidth >= 1280) {+ return <DesktopIcon color={color} />;+ }+ if (breakpoint.minWidth >= 1024) {+ return <LaptopIcon color={color} />;+ }+ if (breakpoint.minWidth >= 768) {+ return <TabletIcon color={color} />;+ }+ if (breakpoint.minWidth >= 360) {+ return <MobileIcon color={color} />;+ }+ return <DevicesIcon color={color} />;+};+export const TriggerButton = forwardRef<ElementRef<typeof Button>,TriggerButtonProps@@ -16,6 +41,7 @@ export const TriggerButton = forwardRef<const [breakpoint] = useSelectedBreakpoint();const [canvasWidth = 0] = useCanvasWidth();if (breakpoint === undefined) return null;+ const variant = canvasWidth >= breakpoint.minWidth ? "contrast" : "gray";return (<Button{...props}@@ -24,10 +50,8 @@ export const TriggerButton = forwardRef<ghostaria-label="Show breakpoints">- <Text- size="1"- variant={canvasWidth > breakpoint.minWidth ? "contrast" : "gray"}- >+ {renderIcon(breakpoint, variant)}+ <Text size="1" variant={variant}>{`${breakpoint.label} ${canvasWidth}px / ${scale}%`}</Text></Button>diff --git a/app/shared/icons/devices.tsx b/app/shared/icons/devices.tsxnew file mode 100644index 0000000000..558fb498e4--- /dev/null+++ b/app/shared/icons/devices.tsx@@ -0,0 +1,25 @@+import * as React from "react";+import { IconProps } from "./types";++export const DevicesIcon = React.forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg+ width="15"+ height="15"+ viewBox="0 0 24 24"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ ref={forwardedRef}+ >+ <path+ fill={color}+ d="M22.265 9.51L17.265 9.5C16.715 9.5 16.265 9.95 16.265 10.5V19.5C16.265 20.05 16.715 20.5 17.265 20.5H22.265C22.815 20.5 23.265 20.05 23.265 19.5V10.5C23.265 9.95 22.815 9.51 22.265 9.51ZM22.265 19.5H17.265V10.5H19.5H22.265V19.5ZM20.265 1.5H2.26499C1.15499 1.5 0.264988 2.39 0.264988 3.5V15.5C0.264988 16.6 1.15499 17.5 2.26499 17.5H10.5V19.5H7.26499V20.5H15.265V19.5H12.5V17.5H15.265V16.5H1.26499V2.5H21.265V8.5H22.265V3.5C22.265 2.39 21.365 1.5 20.265 1.5Z"+ />+ </svg>+ );+ }+);++DevicesIcon.displayName = "DevicesIcon";diff --git a/app/shared/icons/index.ts b/app/shared/icons/index.tsindex 10704ecf07..4e98751c66 100644--- a/app/shared/icons/index.ts+++ b/app/shared/icons/index.ts@@ -1,6 +1,8 @@export * from "@radix-ui/react-icons";-export { ListNestedIcon } from "./list-nested";-export { BrushIcon } from "./brush";-export { FormIcon } from "./form";-export { UndoIcon } from "./undo";-export { RedoIcon } from "./redo";+export * from "./list-nested";+export * from "./brush";+export * from "./form";+export * from "./undo";+export * from "./redo";+export * from "./devices";+export * from "./tablet";diff --git a/app/shared/icons/tablet.tsx b/app/shared/icons/tablet.tsxnew file mode 100644index 0000000000..f3a9073264--- /dev/null+++ b/app/shared/icons/tablet.tsx@@ -0,0 +1,25 @@+import * as React from "react";+import { IconProps } from "./types";++export const TabletIcon = React.forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg+ width="15"+ height="15"+ viewBox="0 0 24 24"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ ref={forwardedRef}+ >+ <path+ fill={color}+ d="M18,0H6C4.34,0,3,1.34,3,3v18c0,1.66,1.34,3,3,3h12c1.66,0,3-1.34,3-3V3C21,1.34,19.66,0,18,0z M14,22h-4v-1h4V22z M19.25,19H4.75V3h14.5V19z"+ />+ </svg>+ );+ }+);++TabletIcon.displayName = "TabletIcon";