Skip to content

Commit

Permalink
feat(column): replace the auto prop in favour of grow and shrink
Browse files Browse the repository at this point in the history
  • Loading branch information
John Persson committed Mar 7, 2018
1 parent 1fd98ec commit 644d7af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/column.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
hidden,
push,
pull,
grow,
shrink,
gutter as gutterMixin,
noGutter,
position,
Expand Down Expand Up @@ -45,6 +47,8 @@ const Column = (props) => {
hidden,
position,
noGutter,
grow,
shrink,
gutter: args => gutterMixin(getGutterWidth(args)),
span: args => span(getColumnWidth(args, fixed)),
push: args => push(getColumnWidth(args)),
Expand All @@ -55,6 +59,8 @@ const Column = (props) => {
return (
<ColumnResponsiveProps
order={props.order}
grow={props.grow}
shrink={props.shrink}
verticalAlign={props.verticalAlign}
span={props.span}
push={props.push}
Expand All @@ -76,8 +82,8 @@ const columnPropTypes = {
children: node,
debug: bool,
fixed: bool,
// auto: bool,
// static: bool,
grow: oneOfType([objectOf(number), number]),
shrink: oneOfType([objectOf(number), number]),
order: oneOfType([objectOf(number), number]),
hidden: oneOfType([objectOf(bool), bool]),
noGutter: oneOfType([objectOf(bool), bool]),
Expand Down
19 changes: 14 additions & 5 deletions src/utils/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ export const span = size => `
max-width: ${size};
`;

export const auto = () => `
flex-grow: 0;
flex-basis: 0;
export const grow = size => `
width: auto;
max-width: none !important;
flex-grow: ${size};
`;

export const shrink = size => `
width: auto;
max-width: none !important;
flex-shrink: ${size};
`;

export const push = pushVal => (`
Expand All @@ -50,8 +57,6 @@ export const noGutter = (val = false) => (
null
);

export const debug = () => '';

export const hidden = val => (
val ? 'display: none;' : 'display: block;'
);
Expand Down Expand Up @@ -102,6 +107,10 @@ export const alignColumns = val => (`
align-items: ${alignValues[val] || 'normal'};
`);

export const debug = () => `
background: line-gradient(from left, red 0, red 100%);
`;

// export const verticalAlignColumns = (val) => {
// const alignment = getVerticalAlignment(val);
//
Expand Down

0 comments on commit 644d7af

Please sign in to comment.