Skip to content

Add Box component#112

Merged
lederer merged 2 commits intomasterfrom
feature/sml/box
Nov 30, 2018
Merged

Add Box component#112
lederer merged 2 commits intomasterfrom
feature/sml/box

Conversation

@lederer
Copy link
Copy Markdown
Contributor

@lederer lederer commented Nov 29, 2018

Overview

Introduce the Box component.

We considered two existing approaches to this component:

  • Kitchen Sink. eg, Pulse. Create an omnibus component that includes virtually every styled-system function.

  • Family of Layout Components. eg, Rebass. Create a set of layout components, one for each layout model. Box would encapsulate styled-system's flow layout functions. Flex would extend Box, set display: flex, and add flex props. Grid would do the same for grid layout.

I opted to thread the needle with a hybrid approach. Our Box component is single component that supports all 3 layouts (flow, flex, grid) but strictly limits itself to layout only (so strictly, in fact, that unlike Rebass it even excludes fontSize and color).

Included styled-system functions

margin & padding: space
layout: display, verticalAlign, all flex props, all grid props
dimensions: width, height, {min, max}{Width, Height}, ratio
containment: overflow
position: position, zIndex, top, right, bottom, left

Excluded styled-system functions

type: fontFamily, textAlign, lineHeight, fontWeight, fontStyle, letterSpacing, textStyle
visual: background*, border*, boxShadow, opacity, colorStyle

Checklist

  • Relevant documentation pages have been created or updated
  • Description of PR is in an appropriate section of the changelog and grouped with similar changes if possible

Are there any of the following in this PR?

  • Changes to the prop names or types of existing components
  • Changes in intended behavior of existing component props
  • Changes in the theme file's structure
  • A required version bump to a non-dev dependency of the project

If one of the above is checked...

  • information or guidance around needed changes for consumers of this library has been added to the changelog under Upgrade Instructions

Demo

image

Closes #87

@lederer lederer requested a review from designmatty November 30, 2018 20:55
Copy link
Copy Markdown
Contributor

@designmatty designmatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@lederer lederer merged commit 2f211a3 into master Nov 30, 2018
@lederer lederer deleted the feature/sml/box branch November 30, 2018 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants