From b0e113b197b421ce2bbec21a36af562cf06c46b7 Mon Sep 17 00:00:00 2001 From: "dave.snider@gmail.com" Date: Wed, 8 Nov 2017 15:11:54 -0800 Subject: [PATCH] New icons, new sizes for EmptyButton and HRs, un-responsive FlexGroups (#126) * Adds a few new icons. * Adds `xs` size to our empty buttons (I don't want this applied to regular buttons, which is why I didn't add it there). * Adds `xs` margin to horizontal rules. * Adds a responsive prop to `EuiFlexGroup` which disables responsiveness (useful when you use flexgroup more for alignment rather than gridding). Added the prop to a few places that make sense. --- .../guide_page/guide_page_chrome.js | 30 ++++++++------ src-docs/src/views/button/button_empty.js | 40 +++++++++++++++++++ src-docs/src/views/flex/flex_example.js | 26 ++++++++++++ src-docs/src/views/flex/flex_responsive.js | 24 +++++++++++ .../horizontal_rule/horizontal_rule_margin.js | 13 +++--- src-docs/src/views/icon/icons.js | 3 ++ .../views/side_nav/side_nav_complicated.js | 18 +++++++-- .../__snapshots__/accordion.test.js.snap | 4 +- .../button/button_empty/_button_empty.scss | 5 +++ .../button/button_empty/button_empty.js | 1 + .../__snapshots__/flex_group.test.js.snap | 2 +- src/components/flex/_flex_group.scss | 2 +- src/components/flex/_flex_item.scss | 2 +- src/components/flex/flex_group.js | 7 +++- .../__snapshots__/header_alert.test.js.snap | 2 +- .../horizontal_rule/_horizontal_rule.scss | 5 ++- .../horizontal_rule/horizontal_rule.js | 1 + .../icon/__snapshots__/icon.test.js.snap | 39 ++++++++++++++++++ src/components/icon/assets/invert.svg | 6 +++ .../icon/assets/minus_in_circle.svg | 3 ++ src/components/icon/assets/pin.svg | 3 ++ src/components/icon/icon.js | 6 +++ src/components/popover/_popover.scss | 1 + 23 files changed, 212 insertions(+), 31 deletions(-) create mode 100644 src-docs/src/views/flex/flex_responsive.js create mode 100644 src/components/icon/assets/invert.svg create mode 100644 src/components/icon/assets/minus_in_circle.svg create mode 100644 src/components/icon/assets/pin.svg diff --git a/src-docs/src/components/guide_page/guide_page_chrome.js b/src-docs/src/components/guide_page/guide_page_chrome.js index 75bbf17390a..27858233d58 100644 --- a/src-docs/src/components/guide_page/guide_page_chrome.js +++ b/src-docs/src/components/guide_page/guide_page_chrome.js @@ -9,6 +9,7 @@ import { import { EuiSideNav, EuiIcon, + EuiButtonEmpty, EuiSideNavItem, EuiSideNavTitle, EuiFieldSearch, @@ -62,20 +63,22 @@ export class GuidePageChrome extends Component { ); return ( - + {homeLink} - - - + Flip theme + ); @@ -163,6 +166,14 @@ export class GuidePageChrome extends Component {
{this.renderIdentity()} + + + + - - - Components diff --git a/src-docs/src/views/button/button_empty.js b/src-docs/src/views/button/button_empty.js index c3f9f5ae4b8..000e93f95d3 100644 --- a/src-docs/src/views/button/button_empty.js +++ b/src-docs/src/views/button/button_empty.js @@ -21,6 +21,15 @@ export default () => ( small +    + + window.alert('Button clicked')} + > + extra small + +

( small +    + + window.alert('Button clicked')} + > + extra small + +

( small +    + + window.alert('Button clicked')} + > + extra small + +

( small +    + + window.alert('Button clicked')} + isDisabled + > + extra small + +

( (
} /> + + + By default EuiFlexGroup is responsive. However, often + you only want to use groups for alignment and margins, rather than layouts. + Simply apply the responsive={`{false}`} prop + to retain a single row layout for the group. +

+ } + demo={ +
+ } + />
); diff --git a/src-docs/src/views/flex/flex_responsive.js b/src-docs/src/views/flex/flex_responsive.js new file mode 100644 index 00000000000..25830be977b --- /dev/null +++ b/src-docs/src/views/flex/flex_responsive.js @@ -0,0 +1,24 @@ +import React from 'react'; + +import { + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiSpacer, +} from '../../../../src/components'; + +export default () => ( +
+ + + On mobile, the icon will show above this text. + + + + + + + On mobile, the icon will stay to the left of this text. + +
+); diff --git a/src-docs/src/views/horizontal_rule/horizontal_rule_margin.js b/src-docs/src/views/horizontal_rule/horizontal_rule_margin.js index 2280c608b0c..bf0c750fbe1 100644 --- a/src-docs/src/views/horizontal_rule/horizontal_rule_margin.js +++ b/src-docs/src/views/horizontal_rule/horizontal_rule_margin.js @@ -6,16 +6,17 @@ import { export default () => (
-

Small

+

xs

+ +

s

-

Medium

+

m

-

Large

+

l (default)

-

XLarge

+

xl

-

XXLarge

+

xxl

); - diff --git a/src-docs/src/views/icon/icons.js b/src-docs/src/views/icon/icons.js index cdcaeaee0b5..732f8b56220 100644 --- a/src-docs/src/views/icon/icons.js +++ b/src-docs/src/views/icon/icons.js @@ -36,13 +36,16 @@ const iconTypes = [ 'gear', 'grid', 'help', + 'invert', 'link', 'list', 'listAdd', 'lock', 'mapMarker', + 'minusInCircle', 'node', 'pencil', + 'pin', 'plusInCircle', 'search', 'shard', diff --git a/src-docs/src/views/side_nav/side_nav_complicated.js b/src-docs/src/views/side_nav/side_nav_complicated.js index 10babc04f0d..ca30442958b 100644 --- a/src-docs/src/views/side_nav/side_nav_complicated.js +++ b/src-docs/src/views/side_nav/side_nav_complicated.js @@ -39,7 +39,11 @@ export default class extends Component { {/* Elasticsearch section */} - + @@ -82,7 +86,11 @@ export default class extends Component { {/* Kibana section */} - + @@ -153,7 +161,11 @@ export default class extends Component { {/* Logstash section */} - + diff --git a/src/components/accordion/__snapshots__/accordion.test.js.snap b/src/components/accordion/__snapshots__/accordion.test.js.snap index 7b514d97118..6dbed35b448 100644 --- a/src/components/accordion/__snapshots__/accordion.test.js.snap +++ b/src/components/accordion/__snapshots__/accordion.test.js.snap @@ -7,7 +7,7 @@ exports[`EuiAccordion is rendered 1`] = ` data-test-subj="test subject string" >
`; diff --git a/src/components/flex/_flex_group.scss b/src/components/flex/_flex_group.scss index 0a924034ad8..fd1db17deaf 100644 --- a/src/components/flex/_flex_group.scss +++ b/src/components/flex/_flex_group.scss @@ -57,7 +57,7 @@ @include screenXSmall { - .euiFlexGroup { + .euiFlexGroup--responsive { flex-wrap: wrap; } } diff --git a/src/components/flex/_flex_item.scss b/src/components/flex/_flex_item.scss index 08866f3f822..83705bc63ba 100644 --- a/src/components/flex/_flex_item.scss +++ b/src/components/flex/_flex_item.scss @@ -17,7 +17,7 @@ // On mobile we force them to stack and act the same. @include screenXSmall { - .euiFlexItem { + .euiFlexGroup--responsive .euiFlexItem { width: 100% !important; flex-basis: 100% !important; margin-left: 0 !important; diff --git a/src/components/flex/flex_group.js b/src/components/flex/flex_group.js index c0ecf37c9fb..86176149fe2 100644 --- a/src/components/flex/flex_group.js +++ b/src/components/flex/flex_group.js @@ -31,12 +31,15 @@ const justifyContentToClassNameMap = { export const JUSTIFY_CONTENTS = Object.keys(justifyContentToClassNameMap); -export const EuiFlexGroup = ({ children, className, gutterSize, alignItems, justifyContent, ...rest }) => { +export const EuiFlexGroup = ({ children, className, gutterSize, alignItems, responsive, justifyContent, ...rest }) => { const classes = classNames( 'euiFlexGroup', gutterSizeToClassNameMap[gutterSize], alignItemsToClassNameMap[alignItems], justifyContentToClassNameMap[justifyContent], + { + 'euiFlexGroup--responsive': responsive, + }, className ); @@ -53,6 +56,7 @@ export const EuiFlexGroup = ({ children, className, gutterSize, alignItems, just EuiFlexGroup.propTypes = { children: PropTypes.node, className: PropTypes.string, + responsive: PropTypes.bool, gutterSize: PropTypes.oneOf(GUTTER_SIZES), alignItems: PropTypes.oneOf(ALIGN_ITEMS), justifyContent: PropTypes.oneOf(JUSTIFY_CONTENTS), @@ -61,5 +65,6 @@ EuiFlexGroup.propTypes = { EuiFlexGroup.defaultProps = { gutterSize: 'l', alignItems: 'stretch', + responsive: true, justifyContent: 'flexStart', }; diff --git a/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap b/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap index a268f1626e0..bf9051d793d 100644 --- a/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap +++ b/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap @@ -32,7 +32,7 @@ exports[`EuiHeaderAlert is rendered 1`] = ` class="euiHeaderAlert__text" />
`; +exports[`EuiIcon renders type invert 1`] = ` + + + invert icon + + + +`; + exports[`EuiIcon renders type link 1`] = ` `; +exports[`EuiIcon renders type minusInCircle 1`] = ` + + + minus in circle icon + + + +`; + exports[`EuiIcon renders type monitoringApp 1`] = ` `; +exports[`EuiIcon renders type pin 1`] = ` + + + pin icon + + + +`; + exports[`EuiIcon renders type plusInCircle 1`] = ` + + + + + diff --git a/src/components/icon/assets/minus_in_circle.svg b/src/components/icon/assets/minus_in_circle.svg new file mode 100644 index 00000000000..fd2689836c9 --- /dev/null +++ b/src/components/icon/assets/minus_in_circle.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/icon/assets/pin.svg b/src/components/icon/assets/pin.svg new file mode 100644 index 00000000000..1ef278960b2 --- /dev/null +++ b/src/components/icon/assets/pin.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/icon/icon.js b/src/components/icon/icon.js index 512ec9498c0..e9002288cf5 100644 --- a/src/components/icon/icon.js +++ b/src/components/icon/icon.js @@ -39,6 +39,7 @@ import './assets/full_screen.svg'; import './assets/gear.svg'; import './assets/grid.svg'; import './assets/help.svg'; +import './assets/invert.svg'; import './assets/link.svg'; import './assets/list_add.svg'; import './assets/list.svg'; @@ -55,8 +56,10 @@ import './assets/logo_webhook.svg'; import './assets/logo_xpack.svg'; import './assets/logo_kibana.svg'; import './assets/map_marker.svg'; +import './assets/minus_in_circle.svg'; import './assets/node.svg'; import './assets/pencil.svg'; +import './assets/pin.svg'; import './assets/plus_in_circle.svg'; import './assets/search.svg'; import './assets/shard.svg'; @@ -106,6 +109,7 @@ const typeToIconMap = { graphApp: 'app_graph', grid: 'grid', help: 'help', + invert: 'invert', link: 'link', list: 'list', listAdd: 'list_add', @@ -124,9 +128,11 @@ const typeToIconMap = { logoXpack: 'logo_xpack', machineLearningApp: 'app_ml', mapMarker: 'map_marker', + minusInCircle: 'minus_in_circle', monitoringApp: 'app_monitoring', node: 'node', pencil: 'pencil', + pin: 'pin', plusInCircle: 'plus_in_circle', search: 'search', shard: 'shard', diff --git a/src/components/popover/_popover.scss b/src/components/popover/_popover.scss index d01aedd2778..bda365e01a8 100644 --- a/src/components/popover/_popover.scss +++ b/src/components/popover/_popover.scss @@ -7,6 +7,7 @@ .euiPopover { display: inline-block; position: relative; + vertical-align: middle; // Open state happens on the wrapper and applies to the panel. &.euiPopover-isOpen {