-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* setting up basic flex component * adding direction props * wip flex * adding flex tests * adding flexitem tests and some flex comments * adding comments * swapping out template quotes for regular quotes * adding basic page actions files * adding swarm icons library * adding raw loader and swarm componets to storybook * cleaning out old icon sprite setup, add in swarm icons to decorator * removing webpacksvgicons dependency * migrating pagetitle to page head * cr: handling @nlax nitpick, adding visualization for justify * cr: spaces * adding style for page head * adding some spacing improvements for info wrapper * reducing down pageHead and pageActionButton down into 2 components, cleaning up styles for info container * linting * cr: adjusting flex component based on comments, adjusting tests to not check for flex and p, cleaning up css * cr: linting * removing icon dependency * updating icon test * updating story with icons * adjusting button tests, and fixing descriptions * updating tests, renaming some of the prop types * cleaning up button a bit more * linting * beforeAll -> beforeEach
- Loading branch information
Lori Hutchek
authored
Feb 12, 2017
1 parent
d4fb5f2
commit b2179d9
Showing
18 changed files
with
694 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.pageActionButton { | ||
border: none; | ||
border-radius: 0; | ||
width: 100%; | ||
} | ||
|
||
@include responsiveBase() { | ||
.pageActionButton { | ||
min-height: $base*$line-height-largeText*2; // text--display height * line-height | ||
justify-content: center; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@include responsiveBase() { | ||
.pageHead { | ||
padding-bottom: $base; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import Button from './Button'; | ||
import Flex from './Flex'; | ||
import FlexItem from './FlexItem'; | ||
|
||
export const PAGE_ACTION_BUTTON_CLASS = 'pageActionButton'; | ||
|
||
/** | ||
* @description Design System Component: Provides `PageActionButtion` button which offers a larger button | ||
* with stacked icon/label or side by side view options. It differs from `Button` in that there | ||
* is now visible button border and offers more enhanced stacking options. Common usage would be | ||
* with `PageHead` component | ||
* @module PageActionButton | ||
*/ | ||
class PageActionButton extends React.Component { | ||
render() { | ||
const { | ||
children, | ||
className, | ||
icon, | ||
label, | ||
stackVertical, | ||
stackVerticalAtMedium, | ||
onClick, | ||
...other | ||
} = this.props; | ||
|
||
let direction, | ||
switchDirection, | ||
justify; | ||
|
||
// if (direction is column) | ||
// icons and labels in stacked rows, | ||
// Otherwise, always labels and icons | ||
// are side by side in a row | ||
if (stackVertical || stackVerticalAtMedium) { | ||
direction = 'column'; | ||
justify = 'center'; | ||
switchDirection = stackVerticalAtMedium ? 'medium' : ''; | ||
} | ||
|
||
return ( | ||
<Button | ||
className={PAGE_ACTION_BUTTON_CLASS} | ||
onClick={onClick} | ||
> | ||
<Flex | ||
direction={direction} | ||
switchDirection={switchDirection} | ||
justify={justify} | ||
className={className} | ||
{...other} | ||
> | ||
{icon && | ||
<FlexItem shrink className='valign--middle'> | ||
{icon} | ||
</FlexItem> | ||
} | ||
{label && | ||
<FlexItem shrink className='valign--middle align--center atMedium_align--left'> | ||
<div className='text--small text--hint'>{label}</div> | ||
</FlexItem> | ||
} | ||
{children} | ||
</Flex> | ||
</Button> | ||
); | ||
} | ||
} | ||
|
||
PageActionButton.propTypes = { | ||
icon: React.PropTypes.element.isRequired, | ||
label: React.PropTypes.oneOfType([ | ||
React.PropTypes.element, | ||
React.PropTypes.string | ||
]).isRequired, | ||
stackVertical: React.PropTypes.bool, | ||
stackVerticalAtMedium: React.PropTypes.bool, | ||
onClick: React.PropTypes.func, | ||
}; | ||
|
||
export default PageActionButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
import cx from 'classnames'; | ||
import Chunk from './Chunk'; | ||
import Flex from './Flex'; | ||
import FlexItem from './FlexItem'; | ||
import Section from './Section'; | ||
|
||
export const PAGE_HEAD_CLASS = 'pageHead'; | ||
export const PAGE_TITLE_CLASS = 'pageTitle'; | ||
export const PAGE_SUBTITLE_CLASS = 'pageSubtitle'; | ||
export const PAGE_ACTIONS_CLASS = 'pageActions'; | ||
export const PAGE_ACTION_CLASS = 'pageAction'; | ||
|
||
/** | ||
* @description Design System Component: `PageHead` creates a | ||
* header, and subtitle container for pages, and provides an optional Flex | ||
* side menu. The side menu can contain any number of items which | ||
* appropriately adjusts to stacked or column view. | ||
* @module PageHead | ||
*/ | ||
class PageHead extends React.Component { | ||
render() { | ||
const { | ||
children, | ||
className, | ||
subtitle, | ||
title, | ||
menuItems, | ||
...other | ||
} = this.props; | ||
|
||
const classNames = cx( | ||
PAGE_HEAD_CLASS, | ||
className | ||
); | ||
|
||
const menuRender = menuItems.map((menuItem, i) => ( | ||
<FlexItem className={PAGE_ACTION_CLASS} key={i} shrink> | ||
{menuItem} | ||
</FlexItem> | ||
)); | ||
|
||
return ( | ||
<Section | ||
className={classNames} | ||
{...other} | ||
> | ||
<Flex | ||
className={PAGE_TITLE_CLASS} | ||
direction='column' | ||
switchDirection='large' | ||
> | ||
<FlexItem> | ||
<Chunk className='align--center atMedium_align--left'> | ||
<h1 className='text--display1'>{title}</h1> | ||
{subtitle && | ||
<p className={`${PAGE_SUBTITLE_CLASS} text--secondary`}>{subtitle}</p> | ||
} | ||
</Chunk> | ||
</FlexItem> | ||
{menuItems.length > 0 && | ||
<FlexItem shrink> | ||
<Flex justify='center' className={PAGE_ACTIONS_CLASS}> | ||
{menuRender} | ||
</Flex> | ||
</FlexItem> | ||
} | ||
</Flex> | ||
{children} | ||
</Section> | ||
); | ||
} | ||
} | ||
|
||
PageHead.propTypes = { | ||
title: React.PropTypes.oneOfType([ | ||
React.PropTypes.string, | ||
React.PropTypes.element | ||
]).isRequired, | ||
subtitle: React.PropTypes.oneOfType([ | ||
React.PropTypes.string, | ||
React.PropTypes.element | ||
]), | ||
menuItems: React.PropTypes.array, | ||
}; | ||
PageHead.defaultProps = { | ||
menuItems: [] | ||
}; | ||
|
||
export default PageHead; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.