Skip to content

Commit

Permalink
FlexGrid now accepts columns={1} (#1210)
Browse files Browse the repository at this point in the history
  • Loading branch information
snide authored Sep 24, 2018
1 parent 58b2a99 commit cff4915
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `4.2.0`.
- Added `1` as a valid value for the `columns` prop in `EuiFlexGrid` ([#1210](https://github.com/elastic/eui/pull/1210))

## [`4.2.0`](https://github.com/elastic/eui/tree/v4.2.0)

Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/flex/flex_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export const FlexExample = {
text: (
<p>
You can set a <EuiCode>columns</EuiCode> prop to specify
anywhere between 2-4 columns. Any more would likely break on laptop screens.
anywhere between 1-4 columns. Any more would likely break on laptop screens.
</p>
),
demo: <div className="guideDemo__highlightGridWrap"><FlexGridColumns /></div>,
Expand Down
6 changes: 6 additions & 0 deletions src/components/flex/__snapshots__/flex_grid.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ exports[`EuiFlexGrid props columns 0 is rendered 1`] = `
/>
`;

exports[`EuiFlexGrid props columns 1 is rendered 1`] = `
<div
class="euiFlexGrid euiFlexGrid--gutterLarge euiFlexGrid--single euiFlexGrid--responsive"
/>
`;

exports[`EuiFlexGrid props columns 2 is rendered 1`] = `
<div
class="euiFlexGrid euiFlexGrid--gutterLarge euiFlexGrid--halves euiFlexGrid--responsive"
Expand Down
1 change: 1 addition & 0 deletions src/components/flex/_flex_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $fractions: (
fourths: 25%,
thirds: 33.3%,
halves: 50%,
single: 100%,
);

@each $gutterName, $gutterSize in $gutterTypes {
Expand Down
4 changes: 4 additions & 0 deletions src/components/flex/flex_grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const GUTTER_SIZES = Object.keys(gutterSizeToClassNameMap);

const columnsToClassNameMap = {
0: 'euiFlexGrid--wrap',
1: 'euiFlexGrid--single',
2: 'euiFlexGrid--halves',
3: 'euiFlexGrid--thirds',
4: 'euiFlexGrid--fourths',
Expand Down Expand Up @@ -46,6 +47,9 @@ EuiFlexGrid.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
gutterSize: PropTypes.oneOf(GUTTER_SIZES),
/**
* Number of columns to show in the grid. Up to 4.
*/
columns: PropTypes.oneOf(COLUMNS).isRequired,
/**
* Allow grid items display at block level on small screens
Expand Down

0 comments on commit cff4915

Please sign in to comment.