Skip to content

Commit 0b22aed

Browse files
committed
Fix dialogs
1 parent 92dee59 commit 0b22aed

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

apps/builder/app/builder/features/project-settings/project-settings.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
List,
1212
ListItem,
1313
Text,
14+
rawTheme,
1415
} from "@webstudio-is/design-system";
1516
import {
1617
$openProjectSettings,
@@ -53,11 +54,10 @@ export const ProjectSettingsView = ({
5354
onOpenChange={onOpenChange}
5455
>
5556
<DialogContent
56-
css={{
57-
width: `calc(${leftPanelWidth} + ${rightPanelWidth})`,
58-
maxWidth: "none",
59-
height: theme.spacing[35],
60-
}}
57+
width={
58+
Number.parseInt(leftPanelWidth) + Number.parseInt(rightPanelWidth)
59+
}
60+
height={Number.parseInt(rawTheme.spacing[35])}
6161
>
6262
<fieldset style={{ display: "contents" }} disabled={!isDesignMode}>
6363
<Flex grow>

apps/builder/app/builder/features/project-settings/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { theme, type CSS } from "@webstudio-is/design-system";
1+
import { rawTheme, theme, type CSS } from "@webstudio-is/design-system";
22
import { getPagePath, type Pages } from "@webstudio-is/sdk";
33

4-
export const leftPanelWidth = theme.spacing[26];
5-
export const rightPanelWidth = theme.spacing[35];
4+
export const leftPanelWidth = rawTheme.spacing[26];
5+
export const rightPanelWidth = rawTheme.spacing[35];
66
export const sectionSpacing: CSS = {
77
paddingInline: theme.panel.paddingInline,
88
};

packages/design-system/src/components/dialog.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,21 @@ const useDraggable = ({
174174
width: "calc(100vw - 40px)",
175175
height: "calc(100vh - 40px)",
176176
}
177-
: {
178-
top: `max(20px, calc(50% - ${height ? height / 2 : 0}px))`,
179-
left: `max(20px, calc(50% - ${width ? width / 2 : 0}px))`,
180-
width,
181-
height,
182-
};
177+
: !width || !height
178+
? {
179+
inset: 0,
180+
margin: "auto",
181+
width,
182+
height,
183+
}
184+
: {
185+
top: `max(20px, calc(50% - ${height / 2}px))`,
186+
bottom: `max(20px, calc(50% - ${height / 2}px))`,
187+
left: `max(20px, calc(50% - ${width / 2}px))`,
188+
right: `max(20px, calc(50% - ${width / 2}px))`,
189+
width,
190+
height,
191+
};
183192

184193
if (minWidth !== undefined) {
185194
style.minWidth = minWidth;
@@ -191,9 +200,13 @@ const useDraggable = ({
191200
if (isMaximized === false) {
192201
if (x !== undefined) {
193202
style.left = x;
203+
style.right = "auto";
204+
style.margin = 0;
194205
}
195206
if (y !== undefined) {
196207
style.top = y;
208+
style.bottom = "auto";
209+
style.margin = 0;
197210
}
198211
}
199212
return style;
@@ -438,6 +451,7 @@ const overlayStyle = css({
438451
const contentStyle = css(panelStyle, {
439452
position: "fixed",
440453
width: "min-content",
454+
height: "min-content",
441455
minWidth: theme.sizes.sidebarWidth,
442456
minHeight: theme.spacing[22],
443457
maxWidth: `calc(100vw - ${theme.spacing[15]})`,

0 commit comments

Comments
 (0)