Skip to content

Box must support all props Flex, Block, etc support #34

Description

@zakbutcher

Box currently doesn't support additional properties defined by Flex. We need to figure out a scalable component architecture that supports component hierarchies.

Approach 1

  • Box is a base component providing all core props for a component set
  • Flex, Block, etc are specific variations of Box to reduce prop fatigue
  • Proven approach that scales reasonably well
<Flex /> === <Box d="flex" />
<Flex direction="column" /> === <Box d="flex" direction="column" />

Approach 2

  • Box is a "render" component that identifies which type of component to render
  • Box removes only the props it needs before passing the rest to Flex
    • e.g. Box is responsible for background color, not Flex
  • Unexplored api, unclear implications regarding performance, benefits, detriments, etc
const Box = ({d, ...restProps}) => {
  if (d === 'flex') {
    return <Flex {...restProps} />
  }
}

Others?

  • Does Box need to support all Flex, Block properties or can it be a "style" component? 🤔
    • Box handles box shadow, border, background color, margin, padding, etc
    • Flex, Block, etc handles display, justify content, etc

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions