vtex / shoreline

Design System for the VTEX Admin, previously called Admin UI
https://shoreline.vtex.com
15 stars 0 forks source link

Bug in Nested Stacks #1684

Open lafray opened 1 week ago

lafray commented 1 week ago

Summary

In the current implementation, when placing a stack as a child of a stack, a spacing problem is generated in which the spacing between the child stack and the other children is different to the spacing between the other children. This spacing will be the same as the child component instead of what was configured for the parent

Expected behavior

When having a parent stack and a child stack that are similar to other children, the spacing of all children of the parent stack must follow the configuration of the parent and the "grandchildren" must follow the configuration of the child stack

Current behavior

When having a parent stack and a child stack that are similar to other children, the spacing between the child stack and the other children is following the configuration of the child stack instead of the parent

Reproducible Example

Reproduced in this code sandbox image

Package

@vtex/shoreline

lafray commented 1 week ago

There is a solution in terms of usage, which is to place a div around the child stack. However, I believe this should be resolved at the package level.

 <Stack space="$space-3" horizontal>
        <div style={itemStyle3}>Item 1</div>
        <Stack space="$space-10">
            <div style={itemStyle3}>Item 2.1</div>
            <div style={itemStyle3}>Item 2.2</div>
            <div style={itemStyle3}>Item 2.3</div>
        </Stack>
        <div style={itemStyle3}>Item 3</div>
</Stack>

The error occurs because the variable contained in the margin property that the parent sets in the child reads the value of the variable that the child sets