diff --git a/.codeclimate.yml b/.codeclimate.yml index ac541cda3..2fca0d306 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -34,3 +34,4 @@ exclude_patterns: - "stories/**/*" - "**/*.stories.js" - "**/stories/" + - "app/javascript/**/*.stories.js" diff --git a/app/javascript/dashboard/assets/scss/widgets/_buttons.scss b/app/javascript/dashboard/assets/scss/widgets/_buttons.scss index edbef16bb..1a72d51df 100644 --- a/app/javascript/dashboard/assets/scss/widgets/_buttons.scss +++ b/app/javascript/dashboard/assets/scss/widgets/_buttons.scss @@ -6,6 +6,10 @@ $default-button-height: 4.0rem; height: $default-button-height; margin-bottom: 0; + .button__content { + width: 100%; + } + .spinner { padding: 0 var(--space-small); } diff --git a/app/javascript/dashboard/i18n/locale/en/agentMgmt.json b/app/javascript/dashboard/i18n/locale/en/agentMgmt.json index ac4a62127..dcc8c9fda 100644 --- a/app/javascript/dashboard/i18n/locale/en/agentMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/agentMgmt.json @@ -90,7 +90,7 @@ } }, "SEARCH": { - "NO_RESULTS": "No agents found." + "NO_RESULTS": "No results found." } } } diff --git a/app/javascript/shared/components/ui/MultiselectDropdown.stories.js b/app/javascript/shared/components/ui/MultiselectDropdown.stories.js new file mode 100644 index 000000000..ff3f366f0 --- /dev/null +++ b/app/javascript/shared/components/ui/MultiselectDropdown.stories.js @@ -0,0 +1,65 @@ +import { action } from '@storybook/addon-actions'; +import Dropdown from './MutiselectDropdown'; + +export default { + title: 'Components/Dropdown/Multiselect Dropdown', + component: Dropdown, + argTypes: { + options: { + control: { + type: 'object', + }, + }, + selectedItem: { + control: { + type: 'object', + }, + }, + multiselectorTitle: { + control: { + type: 'text', + }, + }, + multiselectorPlaceholder: { + control: { + type: 'text', + }, + }, + noSearchResult: { + control: { + type: 'text', + }, + }, + inputPlaceholder: { + control: { + type: 'text', + }, + }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { Dropdown }, + template: '', +}); + +export const MultiselectDropdown = Template.bind({}); +MultiselectDropdown.args = { + onClick: action('Opened'), + options: [ + { + id: 1, + availability_status: 'online', + name: 'James Philip', + thumbnail: 'https://randomuser.me/api/portraits/men/4.jpg', + }, + ], + + selectedItem: { + id: 1, + availability_status: 'online', + name: 'James Philip', + thumbnail: 'https://randomuser.me/api/portraits/men/4.jpg', + }, +}; diff --git a/app/javascript/shared/components/ui/MultiselectDropdownItems.stories.js b/app/javascript/shared/components/ui/MultiselectDropdownItems.stories.js new file mode 100644 index 000000000..a3f057eaa --- /dev/null +++ b/app/javascript/shared/components/ui/MultiselectDropdownItems.stories.js @@ -0,0 +1,67 @@ +import { action } from '@storybook/addon-actions'; +import DropdownItems from './MultiselectDropdownItems'; + +export default { + title: 'Components/Dropdown/Multiselect Dropdown Items', + component: DropdownItems, + argTypes: { + options: { + control: { + type: 'object', + }, + }, + selectedItem: { + control: { + type: 'object', + }, + }, + inputPlaceholder: { + control: { + type: 'text', + }, + }, + noSearchResult: { + control: { + type: 'text', + }, + }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { DropdownItems }, + template: + '', +}); + +export const MultiselectDropdownItems = Template.bind({}); +MultiselectDropdownItems.args = { + onClick: action('Added'), + options: [ + { + id: '0', + name: 'None', + thumbnail: '', + }, + { + id: '1', + name: 'James Philip', + availability_status: 'online', + role: 'administrator', + thumbnail: 'https://randomuser.me/api/portraits/men/4.jpg', + }, + { + id: '2', + name: 'Support Team', + thumbnail: '', + }, + { + id: '3', + name: 'Agent', + thumbnail: '', + }, + ], + + selectedItem: { id: '1' }, +}; diff --git a/app/javascript/shared/components/ui/MultiselectDropdownItems.vue b/app/javascript/shared/components/ui/MultiselectDropdownItems.vue new file mode 100644 index 000000000..d95b013ef --- /dev/null +++ b/app/javascript/shared/components/ui/MultiselectDropdownItems.vue @@ -0,0 +1,197 @@ + + + + + diff --git a/app/javascript/shared/components/ui/MutiselectDropdown.vue b/app/javascript/shared/components/ui/MutiselectDropdown.vue new file mode 100644 index 000000000..5f99a8dbd --- /dev/null +++ b/app/javascript/shared/components/ui/MutiselectDropdown.vue @@ -0,0 +1,165 @@ + + + + +