Skip to content

experimental: Improve readability in advanced section #4852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ const AddProperty = forwardRef<
);
});

// Used to indent the values when they are on the next line. This way its easier to see
// where the property ends and value begins, especially in case of presets.
const indentation = `20px`;

const AdvancedPropertyLabel = ({
property,
onReset,
Expand Down Expand Up @@ -334,6 +338,7 @@ const AdvancedPropertyLabel = ({
text="mono"
css={{
backgroundColor: "transparent",
marginLeft: `-${indentation}`,
}}
>
{label}
Expand Down Expand Up @@ -542,6 +547,7 @@ const AdvancedProperty = memo(
// with "auto" it will call it with skipped false for all initial elements.
// 44px is the height of the property row with 2 lines of text. This value can be adjusted slightly.
containIntrinsicSize: "auto 44px",
paddingLeft: indentation,
}}
key={property}
wrap="wrap"
Expand All @@ -551,12 +557,20 @@ const AdvancedProperty = memo(
{isVisible && (
<>
<AdvancedPropertyLabel property={property} onReset={onReset} />
<Text>:</Text>
<AdvancedPropertyValue
autoFocus={autoFocus}
property={property}
onChangeComplete={onChangeComplete}
/>
<Text
variant="mono"
// Improves the visual separation of value from the property.
css={{ textIndent: "-0.5ch", fontWeight: "bold" }}
>
:
</Text>
<Box css={{ color: "red" }}>
<AdvancedPropertyValue
autoFocus={autoFocus}
property={property}
onChangeComplete={onChangeComplete}
/>
</Box>
</>
)}
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/components/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const StyledLabel = styled(RadixLabel, {
},
preset: {
backgroundColor: theme.colors.backgroundPresetMain,
color: theme.colors.foregroundMain,
color: theme.colors.foregroundTextSubtle,
"&:hover": {
backgroundColor: theme.colors.backgroundPresetHover,
},
Expand Down
Loading