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.

Minor menu fixes (#852)

Roman Pominov4a9c7842e64c
diff --git a/apps/designer/app/dashboard/header.tsx b/apps/designer/app/dashboard/header.tsx
index 05b796bdc3..c32778d3dd 100644
--- a/apps/designer/app/dashboard/header.tsx
+++ b/apps/designer/app/dashboard/header.tsx
@@ -5,7 +5,6 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
- Text,
Flex,
Avatar,
css,
@@ -52,7 +51,7 @@ const Menu = ({ user }: { user: User }) => {
<DropdownMenuContent>
<DropdownMenuLabel>{title}</DropdownMenuLabel>
<DropdownMenuItem onSelect={() => navigate(logoutPath())}>
- <Text>Logout</Text>
+ Logout
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
diff --git a/apps/designer/app/dashboard/project-card.tsx b/apps/designer/app/dashboard/project-card.tsx
index ec6ba76c38..acf510efcd 100644
--- a/apps/designer/app/dashboard/project-card.tsx
+++ b/apps/designer/app/dashboard/project-card.tsx
@@ -141,20 +141,12 @@ const Menu = ({
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
- <DropdownMenuItem onSelect={onDuplicate}>
- <Text>Duplicate</Text>
- </DropdownMenuItem>
- <DropdownMenuItem onSelect={onRename}>
- <Text>Rename</Text>
- </DropdownMenuItem>
+ <DropdownMenuItem onSelect={onDuplicate}>Duplicate</DropdownMenuItem>
+ <DropdownMenuItem onSelect={onRename}>Rename</DropdownMenuItem>
{isFeatureEnabled("share2") && (
- <DropdownMenuItem>
- <Text>Share</Text>
- </DropdownMenuItem>
+ <DropdownMenuItem>Share</DropdownMenuItem>
)}
- <DropdownMenuItem onSelect={onDelete}>
- <Text>Delete</Text>
- </DropdownMenuItem>
+ <DropdownMenuItem onSelect={onDelete}>Delete</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
diff --git a/apps/designer/app/designer/features/breakpoints/breakpoints.tsx b/apps/designer/app/designer/features/breakpoints/breakpoints.tsx
index d9c07379a7..cf62ea569e 100644
--- a/apps/designer/app/designer/features/breakpoints/breakpoints.tsx
+++ b/apps/designer/app/designer/features/breakpoints/breakpoints.tsx
@@ -3,7 +3,6 @@ import store from "immerhin";
import { type Breakpoint } from "@webstudio-is/css-data";
import { useSubscribe } from "~/shared/pubsub";
import {
- Text,
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
@@ -11,7 +10,7 @@ import {
DropdownMenuPortal,
DropdownMenuSeparator,
DropdownMenuTrigger,
- Flex,
+ DropdownMenuItemRightSlot,
} from "@webstudio-is/design-system";
import { useSelectedBreakpoint } from "../../shared/nano-states";
import { BreakpointsEditor } from "./breakpoints-editor";
@@ -33,28 +32,6 @@ import { utils } from "@webstudio-is/project";
import { removeByMutable } from "~/shared/array-utils";
import { theme } from "@webstudio-is/design-system";
-type BreakpointSelectorItemProps = {
- breakpoint: Breakpoint;
-};
-
-const BreakpointSelectorItem = ({
- breakpoint,
-}: BreakpointSelectorItemProps) => {
- return (
- <Flex align="center" justify="between" gap="3" css={{ flexGrow: 1 }}>
- <Text>{breakpoint.label}</Text>
- <Text>{breakpoint.minWidth}</Text>
- </Flex>
- );
-};
-const menuItemCss = {
- display: "flex",
- gap: theme.spacing[9],
- justifyContent: "start",
- flexGrow: 1,
- minWidth: 180,
-};
-
export const Breakpoints = () => {
const [view, setView] = useState<
"selector" | "editor" | "confirmation" | undefined
@@ -162,7 +139,6 @@ export const Breakpoints = () => {
<DropdownMenuCheckboxItem
checked={breakpoint === selectedBreakpoint}
key={breakpoint.id}
- css={menuItemCss}
onMouseEnter={() => {
setBreakpointPreview(breakpoint);
}}
@@ -173,7 +149,10 @@ export const Breakpoints = () => {
setSelectedBreakpoint(breakpoint);
}}
>
- <BreakpointSelectorItem breakpoint={breakpoint} />
+ {breakpoint.label}
+ <DropdownMenuItemRightSlot>
+ {breakpoint.minWidth}
+ </DropdownMenuItemRightSlot>
</DropdownMenuCheckboxItem>
);
})}
@@ -192,7 +171,7 @@ export const Breakpoints = () => {
setView("editor");
}}
>
- {"Edit breakpoints"}
+ Edit breakpoints
</DropdownMenuItem>
</>
)}
diff --git a/apps/designer/app/designer/features/breakpoints/preview.tsx b/apps/designer/app/designer/features/breakpoints/preview.tsx
index 996f1e6c85..0223f051d1 100644
--- a/apps/designer/app/designer/features/breakpoints/preview.tsx
+++ b/apps/designer/app/designer/features/breakpoints/preview.tsx
@@ -9,7 +9,14 @@ type PreviewProps = {
export const Preview = ({ breakpoint }: PreviewProps) => {
return (
<Flex
- css={{ px: theme.spacing[11], py: theme.spacing[3] }}
+ css={{
+ px: theme.spacing[11],
+ py: theme.spacing[3],
+
+ // need a constant width to avoid entire menu width change
+ // as user hovers over different breakpoints
+ width: theme.spacing[29],
+ }}
gap="1"
direction="column"
>
diff --git a/apps/designer/app/designer/features/topbar/menu/menu.tsx b/apps/designer/app/designer/features/topbar/menu/menu.tsx
index 46a5260d61..831f5a0455 100644
--- a/apps/designer/app/designer/features/topbar/menu/menu.tsx
+++ b/apps/designer/app/designer/features/topbar/menu/menu.tsx
@@ -47,7 +47,7 @@ const ThemeMenuItem = () => {
return (
<DropdownMenuSub>
<DropdownMenuSubTrigger>Theme</DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
+ <DropdownMenuSubContent width="regular">
{settings.map((setting) => (
<DropdownMenuCheckboxItem
key={setting}
@@ -70,7 +70,7 @@ const ViewMenuItem = () => {
return (
<DropdownMenuSub>
<DropdownMenuSubTrigger>View</DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
+ <DropdownMenuSubContent width="regular">
<DropdownMenuCheckboxItem
checked={clientSettings.navigatorLayout === "undocked"}
onSelect={() => {
@@ -123,6 +123,7 @@ export const Menu = ({ publish }: MenuProps) => {
css={{ zIndex: theme.zIndices[1] }}
sideOffset={4}
collisionPadding={4}
+ width="regular"
>
<DropdownMenuItem
onSelect={() => {
diff --git a/packages/design-system/src/components/dropdown-menu.tsx b/packages/design-system/src/components/dropdown-menu.tsx
index 46485106c2..33e5f92b54 100644
--- a/packages/design-system/src/components/dropdown-menu.tsx
+++ b/packages/design-system/src/components/dropdown-menu.tsx
@@ -26,13 +26,10 @@ export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
export const DropdownMenuContent = styled(
DropdownMenuPrimitive.Content,
- menuCss,
- { defaultVariants: { width: "regular" } }
+ menuCss
);
-const SubContentStyled = styled(DropdownMenuPrimitive.SubContent, subMenuCss, {
- defaultVariants: { width: "regular" },
-});
+const SubContentStyled = styled(DropdownMenuPrimitive.SubContent, subMenuCss);
export const DropdownMenuSubContent = forwardRef<
ElementRef<typeof SubContentStyled>,
ComponentProps<typeof SubContentStyled>
diff --git a/packages/design-system/src/components/menu.stories.tsx b/packages/design-system/src/components/menu.stories.tsx
index 516e65be88..08b2af59d9 100644
--- a/packages/design-system/src/components/menu.stories.tsx
+++ b/packages/design-system/src/components/menu.stories.tsx
@@ -54,7 +54,7 @@ const DropdownDemo = ({ withIndicator }: { withIndicator: boolean }) => {
<DropdownMenuTrigger asChild>
<Button prefix={<MenuIcon />} />
</DropdownMenuTrigger>
- <DropdownMenuContent>
+ <DropdownMenuContent width="regular">
<DropdownMenuLabel>Not choosable</DropdownMenuLabel>
<DropdownMenuItem withIndicator={withIndicator}>
@@ -78,7 +78,7 @@ const DropdownDemo = ({ withIndicator }: { withIndicator: boolean }) => {
<DropdownMenuSubTrigger withIndicator={withIndicator}>
Open sub-menu
</DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
+ <DropdownMenuSubContent width="regular">
<DropdownMenuItem withIndicator={withIndicator}>
Regular
</DropdownMenuItem>