Skip to content

Components are sensitive to props order #227

@kettanaito

Description

@kettanaito

What:

The library analyzes given props to all of exported components (Box, Composition) and performs two things:

  1. Generates respective CSS string to pass to styled-components;
  2. Generates areas component to render (in case of Composition).

When given a set of props in a random order (not logical order), the outcome of this analyzis is wrong:

<Composition
  areasLg="left right"
  areas="left"
  areasMd="left right"
/>

Atomic Layout won't be able to properly construct the areas components taking the scenario above. areas props would need to be listed in logical order: areas -> areasMd -> areasLg.

Why:

The issue is that prop analyzis takes the props in the order they were declared. There is also no reliable way to determine in which sequence the props must be sorted.

Expected behavior:

It would be more resilient to changes if the library could understand the logical flow of props on its own. This would support arbitrary props order and allow some corner-case dynamic props composition.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions