feat: Outline Section UX improvement (#2789)

## Description

1. What is this PR about (link the issue and add a short description)
The PR has 2 improvements mentioned in the issue #2602 :
 * Ordered the Outline section after the Effects section
 * Hides all properties except Style until a Style value is selected
 
## Steps for reproduction

1. Login and create a project.
2. On the style section on the right side of the screen. scroll down to
find the updates.
3.  Outline section has shifted below Effects section.
4. And only on selecting the other toggles on style property other than
none, renders the colour, width and offset properties.


## Code Review

- [x] 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

- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [x] tested locally and on preview environment (preview dev login:
d252)
- [ ] 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.example`
and the `builder/env-check.js` if mandatory

---------

Co-authored-by: ShyanRoyChoudhury <shayan.roy31@gmail.com>
This commit is contained in:
Oleg IsonenandShyanRoyChoudhury authored and GitHub committed 2024-01-21 17:22:31 +01:00
1 parent eb5f9809ba
commit ce2a5ebc52
3 files changed
+44 -35

No files matched your search

@@ -18,6 +18,11 @@ const properties: StyleProperty[] = [
export const OutlineSection = (props: RenderCategoryProps) => {
const { currentStyle, setProperty, deleteProperty } = props;
const { outlineStyle } = currentStyle;
if (outlineStyle?.value.type !== "keyword") {
return;
}
return (
<CollapsibleSection
@@ -31,45 +36,48 @@ export const OutlineSection = (props: RenderCategoryProps) => {
setProperty={setProperty}
deleteProperty={deleteProperty}
/>
{outlineStyle.value.value !== "none" && (
<>
<Grid
css={{
gridTemplateColumns: `1fr ${theme.spacing[20]} ${theme.spacing[12]}`,
}}
gapX={2}
>
<PropertyName
style={currentStyle}
properties={[property]}
label={"Color"}
onReset={() => deleteProperty(property)}
/>
<Grid
css={{
gridTemplateColumns: `1fr ${theme.spacing[20]} ${theme.spacing[12]}`,
}}
gapX={2}
>
<PropertyName
style={currentStyle}
properties={[property]}
label={"Color"}
onReset={() => deleteProperty(property)}
/>
<Box
css={{
gridColumn: `span 2`,
}}
>
<ColorControl
property={property}
currentStyle={currentStyle}
setProperty={setProperty}
deleteProperty={deleteProperty}
/>
</Box>
</Grid>
<Box
css={{
gridColumn: `span 2`,
}}
>
<ColorControl
property={property}
<OutlineWidth
currentStyle={currentStyle}
setProperty={setProperty}
deleteProperty={deleteProperty}
/>
</Box>
</Grid>
<OutlineWidth
currentStyle={currentStyle}
setProperty={setProperty}
deleteProperty={deleteProperty}
/>
<OutlineOffset
currentStyle={currentStyle}
setProperty={setProperty}
deleteProperty={deleteProperty}
/>
<OutlineOffset
currentStyle={currentStyle}
setProperty={setProperty}
deleteProperty={deleteProperty}
/>
</>
)}
</Flex>
</CollapsibleSection>
);
@@ -40,8 +40,8 @@ export const categories = [
"backgrounds",
"borders",
"boxShadows",
"outline",
"effects",
"outline",
"transitions",
] as const;
@@ -141,7 +141,7 @@ export const shouldRenderCategory = (
export const sections: Record<
Category,
(props: RenderCategoryProps) => JSX.Element | null
(props: RenderCategoryProps) => JSX.Element | undefined
> = {
layout: LayoutSection,
flexChild: FlexChildSection,
+2 -1
View File
@@ -24,8 +24,9 @@ const S3_KEYS = [
const errors = [];
REQUIRED_ENVS.map((env) => {
if (!process.env[env])
if (!process.env[env]) {
errors.push(`👉 The ${env} environment variable is required`);
}
});
if (process.env.DEPLOYMENT_ENVIRONMENT === "production") {