Skip to content

Commit d60d3c5

Browse files
authored
experimental: Improve readability in advanced section (#4852)
#4816 ## Description Improved readability by: 1. indentation 2. setting gray color for preset properties 3. making colon bolder <img width="258" alt="image" src="https://github.com/user-attachments/assets/60528221-35f3-4782-986f-8656a9b6bffd" /> ## Steps for reproduction 1. click button 4. 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: 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 93334da commit d60d3c5

File tree

2 files changed

+21
-7
lines changed
  • apps/builder/app/builder/features/style-panel/sections/advanced
  • packages/design-system/src/components

2 files changed

+21
-7
lines changed

apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ const AddProperty = forwardRef<
288288
);
289289
});
290290

291+
// Used to indent the values when they are on the next line. This way its easier to see
292+
// where the property ends and value begins, especially in case of presets.
293+
const indentation = `20px`;
294+
291295
const AdvancedPropertyLabel = ({
292296
property,
293297
onReset,
@@ -334,6 +338,7 @@ const AdvancedPropertyLabel = ({
334338
text="mono"
335339
css={{
336340
backgroundColor: "transparent",
341+
marginLeft: `-${indentation}`,
337342
}}
338343
>
339344
{label}
@@ -542,6 +547,7 @@ const AdvancedProperty = memo(
542547
// with "auto" it will call it with skipped false for all initial elements.
543548
// 44px is the height of the property row with 2 lines of text. This value can be adjusted slightly.
544549
containIntrinsicSize: "auto 44px",
550+
paddingLeft: indentation,
545551
}}
546552
key={property}
547553
wrap="wrap"
@@ -551,12 +557,20 @@ const AdvancedProperty = memo(
551557
{isVisible && (
552558
<>
553559
<AdvancedPropertyLabel property={property} onReset={onReset} />
554-
<Text>:</Text>
555-
<AdvancedPropertyValue
556-
autoFocus={autoFocus}
557-
property={property}
558-
onChangeComplete={onChangeComplete}
559-
/>
560+
<Text
561+
variant="mono"
562+
// Improves the visual separation of value from the property.
563+
css={{ textIndent: "-0.5ch", fontWeight: "bold" }}
564+
>
565+
:
566+
</Text>
567+
<Box css={{ color: "red" }}>
568+
<AdvancedPropertyValue
569+
autoFocus={autoFocus}
570+
property={property}
571+
onChangeComplete={onChangeComplete}
572+
/>
573+
</Box>
560574
</>
561575
)}
562576
</Flex>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const StyledLabel = styled(RadixLabel, {
6464
},
6565
preset: {
6666
backgroundColor: theme.colors.backgroundPresetMain,
67-
color: theme.colors.foregroundMain,
67+
color: theme.colors.foregroundTextSubtle,
6868
"&:hover": {
6969
backgroundColor: theme.colors.backgroundPresetHover,
7070
},

0 commit comments

Comments
 (0)