From ac1affcb6bd65afd901de3312ea0f161493fa3fc Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 27 Aug 2020 12:13:58 -0400 Subject: [PATCH 1/2] feat: Add option to hide dropdown indicator icon --- .../components/rose/dropdown.stories.mdx | 21 +++++++++++++++---- .../rose/components/dropdown/_dropdown.scss | 5 +++++ .../templates/components/rose/dropdown.hbs | 2 +- .../rose/tests/dummy/app/templates/index.hbs | 5 +++++ .../components/rose/dropdown-test.js | 8 +++++++ 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/addons/rose/addon/components/rose/dropdown.stories.mdx b/addons/rose/addon/components/rose/dropdown.stories.mdx index c2f71d82f..9cb71ca99 100644 --- a/addons/rose/addon/components/rose/dropdown.stories.mdx +++ b/addons/rose/addon/components/rose/dropdown.stories.mdx @@ -1,5 +1,6 @@ import { Meta, Story, Preview } from '@storybook/addon-docs/blocks'; import { hbs } from 'ember-cli-htmlbars'; +import { boolean } from '@storybook/addon-knobs'; @@ -10,13 +11,16 @@ A simple dropdown component with support for links and buttons. {{ template: hbs` - + Menu item Menu item Button menu item `, + context: { + hideDropdownIndicator: boolean('hideDropdownIndicator', false), + }, }} @@ -34,7 +38,7 @@ A simple dropdown component with support for links and buttons. -```htmlbars +```html Menu item Menu item @@ -44,7 +48,7 @@ A simple dropdown component with support for links and buttons. Dropdown content can be aligned to right edge of the component instead of the default left edge, which is the default setting. The following example floats the component to right edge of the page inorder to provide enough space to display right aligned dropdown content. -```htmlbars +```html Menu item Menu item @@ -55,9 +59,18 @@ Dropdown content can be aligned to right edge of the component instead of the de Dropdown supports `danger` styling through `style` attribute. -```htmlbars +```html Link - danger Button - danger ``` + +Dropdown indicator can be hidden using `hideDropdownIndicator` attribute. + +```html + + Menu item + Button menu item + +``` \ No newline at end of file diff --git a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss index 34b2753b0..c0804ea97 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss @@ -58,6 +58,11 @@ $chevron: "data:image/svg+xml;utf-8, diff --git a/addons/rose/tests/dummy/app/templates/index.hbs b/addons/rose/tests/dummy/app/templates/index.hbs index 529b6c7c5..840ae42fa 100644 --- a/addons/rose/tests/dummy/app/templates/index.hbs +++ b/addons/rose/tests/dummy/app/templates/index.hbs @@ -36,3 +36,8 @@ Button menu item Button - danger + + + Menu item + Button menu item + diff --git a/addons/rose/tests/integration/components/rose/dropdown-test.js b/addons/rose/tests/integration/components/rose/dropdown-test.js index 0c0c22695..51c34cf7d 100644 --- a/addons/rose/tests/integration/components/rose/dropdown-test.js +++ b/addons/rose/tests/integration/components/rose/dropdown-test.js @@ -10,6 +10,7 @@ module('Integration | Component | rose/dropdown', function (hooks) { await render(hbs``); assert.ok(find('.rose-dropdown')); assert.notOk(find('.rose-dropdown-right')); + assert.notOk(find('.hide-dropdown-indicator')); }); test('it renders with html attributes', async function (assert) { @@ -40,6 +41,13 @@ module('Integration | Component | rose/dropdown', function (hooks) { assert.ok(find('.rose-dropdown-right')); }); + test('it supports hiding dropdown indicator', async function (assert) { + await render(hbs` + + `); + assert.ok(find('.hide-dropdown-indicator')); + }); + test('it renders with content', async function (assert) { await render(hbs` From fec4178970dfa1d7953981d6c9cc830ccdfafa06 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 27 Aug 2020 14:58:43 -0400 Subject: [PATCH 2/2] feat: Update 'hideDropdownIndicator' to 'showCaret' --- addons/rose/addon/components/rose/dropdown.js | 1 + .../rose/addon/components/rose/dropdown.stories.mdx | 8 ++++---- .../styles/rose/components/dropdown/_dropdown.scss | 10 +++++----- .../addon/templates/components/rose/dropdown.hbs | 2 +- addons/rose/tests/dummy/app/templates/index.hbs | 2 +- .../integration/components/rose/dropdown-test.js | 12 ++++++------ 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/addons/rose/addon/components/rose/dropdown.js b/addons/rose/addon/components/rose/dropdown.js index 8ae6f56e6..645c888be 100644 --- a/addons/rose/addon/components/rose/dropdown.js +++ b/addons/rose/addon/components/rose/dropdown.js @@ -10,6 +10,7 @@ export default Component.extend({ layout, tagName: '', + showCaret: true, // =actions diff --git a/addons/rose/addon/components/rose/dropdown.stories.mdx b/addons/rose/addon/components/rose/dropdown.stories.mdx index 9cb71ca99..7191f7479 100644 --- a/addons/rose/addon/components/rose/dropdown.stories.mdx +++ b/addons/rose/addon/components/rose/dropdown.stories.mdx @@ -11,7 +11,7 @@ A simple dropdown component with support for links and buttons. {{ template: hbs` - + Menu item Menu item @@ -19,7 +19,7 @@ A simple dropdown component with support for links and buttons. `, context: { - hideDropdownIndicator: boolean('hideDropdownIndicator', false), + showCaret: boolean('showCaret', true), }, }} @@ -66,10 +66,10 @@ Dropdown supports `danger` styling through `style` attribute. ``` -Dropdown indicator can be hidden using `hideDropdownIndicator` attribute. +Dropdown indicator can be hidden using `showCaret` attribute. ```html - + Menu item Button menu item diff --git a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss index c0804ea97..0194a485c 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss @@ -16,9 +16,8 @@ $chevron: "data:image/svg+xml;utf-8, diff --git a/addons/rose/tests/dummy/app/templates/index.hbs b/addons/rose/tests/dummy/app/templates/index.hbs index 840ae42fa..146a49749 100644 --- a/addons/rose/tests/dummy/app/templates/index.hbs +++ b/addons/rose/tests/dummy/app/templates/index.hbs @@ -37,7 +37,7 @@ Button - danger - + Menu item Button menu item diff --git a/addons/rose/tests/integration/components/rose/dropdown-test.js b/addons/rose/tests/integration/components/rose/dropdown-test.js index 51c34cf7d..24d4d7758 100644 --- a/addons/rose/tests/integration/components/rose/dropdown-test.js +++ b/addons/rose/tests/integration/components/rose/dropdown-test.js @@ -10,7 +10,6 @@ module('Integration | Component | rose/dropdown', function (hooks) { await render(hbs``); assert.ok(find('.rose-dropdown')); assert.notOk(find('.rose-dropdown-right')); - assert.notOk(find('.hide-dropdown-indicator')); }); test('it renders with html attributes', async function (assert) { @@ -41,11 +40,12 @@ module('Integration | Component | rose/dropdown', function (hooks) { assert.ok(find('.rose-dropdown-right')); }); - test('it supports hiding dropdown indicator', async function (assert) { - await render(hbs` - - `); - assert.ok(find('.hide-dropdown-indicator')); + test('it supports hiding dropdown caret', async function (assert) { + await render(hbs``); + assert.ok(find('.show-caret')); + + await render(hbs``); + assert.notOk(find('.show-caret')); }); test('it renders with content', async function (assert) {