Skip to content

Commit 75b82d6

Browse files
authored
feat: Additional way to reset in spacing (#4924)
## Description closes #4844 As a user when I don't know about option+click shorthand, and try to reset spacing, only other way is to wait for the tooltip to come. If you click, like you do on other labels - input will come but no way to reset. Solution: show a label next to the input. ## Steps for reproduction 1. click on any spacing value 2. see label next to input 3. test usual label functionality ## 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: 0000) - [ ] 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 ddc425c commit 75b82d6

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

apps/builder/app/builder/features/style-panel/sections/shared/input-popover.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@ import {
55
Popover,
66
PopoverTrigger,
77
PopoverContent,
8+
Flex,
9+
theme,
810
} from "@webstudio-is/design-system";
911
import type { StyleProperty, StyleValue } from "@webstudio-is/css-engine";
12+
import { propertyDescriptions } from "@webstudio-is/css-data";
1013
import {
1114
CssValueInput,
1215
type IntermediateStyleValue,
1316
} from "../../shared/css-value-input";
1417
import { createBatchUpdate } from "../../shared/use-style-data";
15-
import { theme } from "@webstudio-is/design-system";
1618
import type { StyleValueSourceColor } from "~/shared/style-object-model";
1719
import { $availableUnitVariables } from "../../shared/model";
1820
import type { Modifiers } from "../../shared/modifier-keys";
21+
import { PropertyLabel } from "../../property-label";
22+
import { humanizeString } from "~/shared/string-utils";
1923

2024
const slideUpAndFade = keyframes({
2125
"0%": { opacity: 0, transform: "scale(0.8)" },
@@ -120,9 +124,10 @@ const Input = ({
120124
const Trigger = styled("div", { position: "absolute", width: 0, height: 0 });
121125

122126
const PopoverContentStyled = styled(PopoverContent, {
127+
flexDirection: "row",
128+
gap: theme.spacing[5],
123129
minWidth: 0,
124130
minHeight: 0,
125-
width: theme.spacing[20],
126131
border: `1px solid ${theme.colors.borderMain}`,
127132
borderRadius: theme.borderRadius[7],
128133
background: theme.colors.backgroundPanel,
@@ -166,13 +171,20 @@ export const InputPopover = ({
166171
// and closing popover before applying changes
167172
onClick={(event) => event.stopPropagation()}
168173
>
169-
<Input
170-
styleSource={styleSource}
171-
value={value}
172-
property={property}
173-
getActiveProperties={getActiveProperties}
174-
onClosePopover={onClose}
174+
<PropertyLabel
175+
label={humanizeString(property)}
176+
description={propertyDescriptions[property]}
177+
properties={[property]}
175178
/>
179+
<Flex css={{ width: theme.spacing[20] }}>
180+
<Input
181+
styleSource={styleSource}
182+
value={value}
183+
property={property}
184+
getActiveProperties={getActiveProperties}
185+
onClosePopover={onClose}
186+
/>
187+
</Flex>
176188
</PopoverContentStyled>
177189
</Popover>
178190
);

0 commit comments

Comments
 (0)