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.

indicate in breakpoint button that breakpoint doesn't apply to canvas

Oleg Isonen73669b1eea25
diff --git a/app/designer/features/breakpoints/trigger-button.tsx b/app/designer/features/breakpoints/trigger-button.tsx
index 5b680d6dd3..3a8d62843d 100644
--- a/app/designer/features/breakpoints/trigger-button.tsx
+++ b/app/designer/features/breakpoints/trigger-button.tsx
@@ -6,16 +6,6 @@ import {
} from "~/designer/shared/nano-values";
import { Button, Text } from "~/shared/design-system";
-const buildStatus = (scale: number, canvasWidth?: number) => {
- const status = [];
- if (canvasWidth !== undefined && canvasWidth > 0) {
- status.push(`${canvasWidth}px`);
- }
- if (status.length !== 0) status.push("/");
- status.push(`${scale}%`);
- return status.join(" ");
-};
-
type TriggerButtonProps = ComponentProps<typeof Button>;
export const TriggerButton = forwardRef<
@@ -24,9 +14,8 @@ export const TriggerButton = forwardRef<
>((props, ref) => {
const [scale] = useScale();
const [breakpoint] = useSelectedBreakpoint();
- const [canvasWidth] = useCanvasWidth();
+ const [canvasWidth = 0] = useCanvasWidth();
if (breakpoint === undefined) return null;
- const status = buildStatus(scale, canvasWidth);
return (
<Button
{...props}
@@ -35,13 +24,12 @@ export const TriggerButton = forwardRef<
ghost
aria-label="Show breakpoints"
>
- <Text size="1">{breakpoint.label}</Text>
-
- {status.length !== 0 && (
- <Text size="1" variant="gray">
- {status}
- </Text>
- )}
+ <Text
+ size="1"
+ variant={canvasWidth > breakpoint.minWidth ? "contrast" : "gray"}
+ >
+ {`${breakpoint.label} ${canvasWidth}px / ${scale}%`}
+ </Text>
</Button>
);
});