Skip to content

Commit

Permalink
v5.1.1 Add width size props to <Page />
Browse files Browse the repository at this point in the history
  • Loading branch information
sqrtofsaturn committed May 20, 2016
1 parent 6078441 commit 851b7c8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zooid-ui",
"version": "5.1.0",
"version": "5.1.1",
"description": "A collection of UI components for React projects.",
"main": "dist/index.js",
"style": "dist/style.css",
Expand Down
13 changes: 12 additions & 1 deletion src/page/index.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
.Page {
min-height: 100%;
width: 100%;
max-width: 1044px;
margin: 32px auto;
}

.Page--small {
max-width: 800px;
}

.Page--medium {
max-width: 1044px;
}

.Page--large {
max-width: 1600px;
}

.Page-header {
display: flex;
justify-content: space-between;
Expand Down
20 changes: 15 additions & 5 deletions src/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@ import PageActions from './actions'
import PageHeader from './header'
import PageTitle from './title'

const AppTitle = (title) => {
if (title) return <PageTitle>{title}</PageTitle>
return null
const PAGE_WIDTHS = ['medium', 'large', 'small', 'full']

const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
width: PropTypes.oneOf(PAGE_WIDTHS),
}

const defaultProps = {
width: PAGE_WIDTHS[0],
}

const Page = ({ children, className }) => {
const classes = classNames('Page', className)
const Page = ({ children, className, width }) => {
const classes = classNames('Page', `Page--${width}`, className)

return <main className={classes}>{children}</main>
}

Page.propTypes = propTypes
Page.defaultProps = defaultProps

export {Page, PageActions, PageHeader, PageTitle}

0 comments on commit 851b7c8

Please sign in to comment.