0.2.0 • Published 4 years ago

@alexseitsinger/react-presentation-components v0.2.0

Weekly downloads
2
License
BSD-2-Clause
Repository
github
Last release
4 years ago

Presentation Components

Some presentation components to make building layouts easier.

Installation

yarn add @alexseitsinger/react-presentation-components

Oritentations

Column

An element which shares the parent element's width, but occupies 100% of the parent's height.

Props
NameDescriptionDefaultRequired?
isMaximizedShould the column use 100% height?falseno
isVerticallyCenteredShould the content be vertically centered?falseno
directionFlexbox direction for children to use.rowno

Row

An element which shares the parent element's height, but occupies 100% of the parent's width.

Props
NameDescriptionDefaultRequired?
directionThe direction that children should use.rowno
isMaximizedShould the row fill 100% width?trueno
spacingSpace within the element.0pxno
endsShould the two contained elements grip the left and right sides?falseno

Positions

All grips take the following props:

NameDescriptionDefaultRequired?
childrenElements to render withinundefinedyes
containerStyleExtra css to apply to the container elementundefinedno
isMaximizedMaximize the primary directionundefinedno

GripBottom

Positions itself to the bottom edge of the parent element.

GripRight

Positions itself to the right edge of the parent element.


Alignments

Center

Elements within are both vertically and horizontally centered.

Wrapper

A container width a max-width: 1200px, and margin: 0 auto.

Props
NameDescriptionDefaultRequired?
maxWidthAlternative value for max-width1200pxno
minHeightAlternative value for min-heightautono

VerticalAlign

Uses the flexbox model to vertically align children.

VerticallyCenter

Uses the inline-block model to vertically align children.


Lists

All lists use the following props:

NameDescriptionDefaultRequired?
childrenThe elements to render within list itemsundefinedif items, no, otherwise yes
spacingThe padding to apply evenly between list itemsundefinedno
renderEachInvoked to render each list item with either children or itemsundefinedif items, yes, else no
renderFirstInvoked to render a list item before all othersundefinedno
renderLastInvoked to render a list item after all othersundefinedno
renderNoneInvoked to render a list item when no items or children produced any output.undefinedno
listStyleExtra css to apply to the list element.undefinedno
itemStyleExtra css to apply to each list item elementundefinedno
itemsAn optional list of data objects to use with renderEach to render each list itemundefinedIf items, yes, else no
isMaximizedShould the list height fill the parent element?falseno

FlexList

A list of items that span across a single line using all available space.

InlineList

A list of items with equal width, that will continue to occupy space on current line, then continue onto the next.

VerticalList

A list of items, separated one per line, with each using 100% width of the parent element.


Dividers

HorizontalDivider

Displays text in the center, with a pair of horizontal lines on the left and right side which run across the center of the remaining width equally.

Props
NameDescriptionDefaultRequired?
textThe text to display between the two horizontal lines.undefinedyes
textColorThe color to display the text in.undefinedno
textSpacingThe spacing to apply to the left and right of the text.undefinedno
lineSizeThe height of each left and right line.1pxno
lineColorThe color of each left and right line.blackno
containerSpacingAdditional spacing to apply to the top and bottom of the container element.undefinedno

HorizontalRule

A single horizontal line across the width of the parent element.

Props
NameDescriptionDefaultRequired?
colorThe color of the line.blackno
insetShould the line be inset?falseno
sizeThe height of the line.1pxno

RightRule

Renders text followed by a horizontal line across the center of the remaining width.

Props
NameDescriptionDefaultRequired?
outerStyleExtra css to apply to the outer container.{}no
innerStyleExtra css to apply to the inner container.{}no
childrenElements to render before the line.undefinedyes
ruleColorColor of the line.blackno
ruleSizeThe height of the line.1px no

VerticalBuffer

A DOM element, which allows for vertical spacing in multiple of the root font-size.

Props
NameDescriptionDefaultRequired?
sizeThe height of the vertical buffer.1remno

Misc

Menu

A container with button to toggle the menu's list item visibility.

Props

Name | Description | Default | Required? onClick | Toggles the visibility of the menu's list items. | undefined | yes children | The elements to render within the menu's list. | undefined | yes

Box

An element with equal width and height.

Props
NameDescriptionDefaultRequired?
sizeThe size(px) to use for the width and heightundefinedyes
childrenElements to renderundefinedyes
isCenteredShould the box be centered within its parentundefinedno
containerSyleExtra css to apply to the container element.undefinedno
bodyStyleExtra css to apply to the body element.undefinedno