Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlexGrid now accepts columns={1} #1210

Merged
merged 3 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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