Skip to content

Commit 02551fa

Browse files
authored
feat: improve vertical space usage (#4307)
## Description - all inputs/buttons have now 24px height - horizontal paddings on all panels are 12px, vertical 8px - optimized for better vertical density - drive-by: removed all old colors, now its all entirely based on typography collection from figma and so we can now make dark mode reality ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 73328b3 commit 02551fa

File tree

104 files changed

+319
-589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+319
-589
lines changed

.storybook/preview.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ const WaitForFonts = ({ children }) => {
4040

4141
const globalStyles = globalCss({
4242
body: {
43-
backgroundColor: theme.colors.background,
44-
color: theme.colors.hiContrast,
43+
color: theme.colors.foregroundMain,
4544
fontFamily: theme.fonts.sans,
4645
},
4746
});

apps/builder/app/builder/features/breakpoints/breakpoints-editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export const BreakpointsEditor = ({ onDelete }: BreakpointsEditorProps) => {
186186
return (
187187
<Flex direction="column">
188188
<PanelTitle
189-
css={{ px: theme.spacing[9] }}
189+
css={{ paddingInline: theme.panel.paddingInline }}
190190
suffix={
191191
<IconButton
192192
onClick={() => {
@@ -209,7 +209,7 @@ export const BreakpointsEditor = ({ onDelete }: BreakpointsEditorProps) => {
209209
{allBreakpoints.map((breakpoint, index, all) => {
210210
return (
211211
<Fragment key={breakpoint.id}>
212-
<Box css={{ px: theme.spacing[7], py: theme.spacing[5] }}>
212+
<Box css={{ p: theme.panel.padding }}>
213213
<BreakpointEditorItem
214214
breakpoint={breakpoint}
215215
onChangeComplete={handleChangeComplete}

apps/builder/app/builder/features/breakpoints/breakpoints-popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const BreakpointsPopover = () => {
113113
)}
114114
{view === "initial" && (
115115
<>
116-
<Flex css={{ px: theme.spacing[7], py: theme.spacing[5] }} gap="3">
116+
<Flex css={{ p: theme.panel.padding }} gap="3">
117117
<WidthInput min={minCanvasWidth} />
118118
<Flex align="center" gap="2">
119119
<Label>Scale</Label>

apps/builder/app/builder/features/footer/footer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const Footer = () => {
1111
height: theme.spacing[11],
1212
background: theme.colors.backgroundTopbar,
1313
color: theme.colors.foregroundContrastMain,
14-
boxShadow: `inset 0 1px 0 0 ${theme.colors.panelOutline}`,
1514
}}
1615
>
1716
<Breadcrumbs />

apps/builder/app/builder/features/inspector/inspector.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
PanelTabsContent,
1212
Card,
1313
Text,
14-
Box,
1514
EnhancedTooltipProvider,
1615
Flex,
1716
ScrollArea,
@@ -48,9 +47,8 @@ const InstanceInfo = ({ instance }: { instance: Instance }) => {
4847
gap="1"
4948
align="center"
5049
css={{
51-
px: theme.spacing[9],
52-
my: theme.spacing[3],
53-
height: theme.spacing[13],
50+
p: theme.panel.padding,
51+
pb: 0,
5452
color: theme.colors.foregroundSubtle,
5553
}}
5654
>
@@ -88,14 +86,12 @@ export const Inspector = ({ navigatorLayout }: InspectorProps) => {
8886

8987
if (selectedInstance === undefined) {
9088
return (
91-
<Box css={{ p: theme.spacing[5], flexBasis: "100%" }}>
89+
<Flex css={{ p: theme.spacing[9] }}>
9290
{/* @todo: use this space for something more usefull: a-la figma's no instance selected sate, maybe create an issue with a more specific proposal? */}
93-
<Card
94-
css={{ p: theme.spacing[9], mt: theme.spacing[9], width: "100%" }}
95-
>
91+
<Card css={{ p: theme.spacing[9], width: "100%" }}>
9692
<Text>Select an instance on the canvas</Text>
9793
</Card>
98-
</Box>
94+
</Flex>
9995
);
10096
}
10197

@@ -183,9 +179,8 @@ export const Inspector = ({ navigatorLayout }: InspectorProps) => {
183179
<ScrollArea>
184180
<InstanceInfo instance={selectedInstance} />
185181
<SettingsPanelContainer
186-
key={
187-
selectedInstance.id /* Re-render when instance changes */
188-
}
182+
// Re-render when instance changes
183+
key={selectedInstance.id}
189184
selectedInstance={selectedInstance}
190185
/>
191186
</ScrollArea>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const ProjectSettingsView = ({
7171
css={{
7272
position: "relative",
7373
height: theme.spacing[13],
74-
px: theme.spacing[9],
74+
paddingInline: theme.panel.paddingInline,
7575
outline: "none",
7676
"&:focus-visible, &:hover": {
7777
background: theme.colors.backgroundHover,
@@ -93,7 +93,7 @@ export const ProjectSettingsView = ({
9393
</Flex>
9494
</List>
9595
<ScrollArea>
96-
<Grid gap={2} css={{ my: theme.spacing[5] }}>
96+
<Grid gap={2} css={{ py: theme.spacing[5] }}>
9797
{currentSection === "general" && <SectionGeneral />}
9898
{currentSection === "redirects" && <SectionRedirects />}
9999
{currentSection === "publish" && <SectionPublish />}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ import { theme, type CSS } from "@webstudio-is/design-system";
33
export const leftPanelWidth = theme.spacing[26];
44
export const rightPanelWidth = theme.spacing[35];
55
export const sectionSpacing: CSS = {
6-
mx: theme.spacing[5],
7-
px: theme.spacing[5],
6+
paddingInline: theme.panel.paddingInline,
87
};

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { SettingsSection } from "./settings-section";
33
import { PropsSectionContainer } from "./props-section/props-section";
44
import { VariablesSection } from "./variables-section";
55
import {
6+
Box,
67
Flex,
78
Link,
89
PanelBanner,
910
Text,
1011
rawTheme,
12+
theme,
1113
} from "@webstudio-is/design-system";
1214
import { UpgradeIcon } from "@webstudio-is/icons";
1315
import { useStore } from "@nanostores/react";
@@ -21,7 +23,7 @@ export const SettingsPanelContainer = ({
2123
}) => {
2224
const { allowDynamicData } = useStore($userPlanFeatures);
2325
return (
24-
<>
26+
<Box css={{ pt: theme.spacing[5] }}>
2527
<SettingsSection />
2628
<PropsSectionContainer selectedInstance={selectedInstance} />
2729
<VariablesSection />
@@ -50,6 +52,6 @@ export const SettingsPanelContainer = ({
5052
</Flex>
5153
</PanelBanner>
5254
)}
53-
</>
55+
</Box>
5456
);
5557
};

apps/builder/app/builder/features/settings-panel/settings-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export const SettingsSection = () => {
3030
});
3131

3232
if (selectedInstance === undefined) {
33-
return null;
33+
return;
3434
}
3535

3636
const meta = metas.get(selectedInstance.component);
3737
if (meta === undefined) {
38-
return null;
38+
return;
3939
}
4040
const placeholder = getInstanceLabel(selectedInstance, meta);
4141

apps/builder/app/builder/features/settings-panel/shared.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export const HorizontalLayout = ({
266266
gridTemplateColumns: deletable
267267
? `${theme.spacing[19]} 1fr max-content`
268268
: `${theme.spacing[19]} 1fr`,
269-
minHeight: theme.spacing[13],
269+
minHeight: theme.spacing[12],
270270
}}
271271
align="center"
272272
gap="2"
@@ -303,7 +303,10 @@ export const Row = ({
303303
children,
304304
css,
305305
}: Pick<ComponentProps<typeof Flex>, "css" | "children">) => (
306-
<Flex css={{ px: theme.spacing[9], ...css }} direction="column">
306+
<Flex
307+
css={{ paddingInline: theme.panel.paddingInline, ...css }}
308+
direction="column"
309+
>
307310
{children}
308311
</Flex>
309312
);

0 commit comments

Comments
 (0)