From 80beeba1e202388c4b9fc3f7ef24c2c429d50210 Mon Sep 17 00:00:00 2001 From: Alex Natalia <38787212+alexnatalia@users.noreply.github.com> Date: Wed, 14 Oct 2020 15:29:58 +0300 Subject: [PATCH 1/3] Switch Component Addition (#65) * Switch Component: Added Component and Story. --- src/components/Switch/SSwitch.vue | 93 +++++++++++++++++++++++++++++++ src/components/Switch/index.ts | 3 + src/components/index.ts | 2 + src/index.ts | 3 + src/stories/SSwitch.stories.ts | 61 ++++++++++++++++++++ src/styles/index.scss | 1 + src/styles/switch.scss | 10 ++++ src/types/components.ts | 1 + 8 files changed, 174 insertions(+) create mode 100644 src/components/Switch/SSwitch.vue create mode 100644 src/components/Switch/index.ts create mode 100644 src/stories/SSwitch.stories.ts create mode 100644 src/styles/switch.scss diff --git a/src/components/Switch/SSwitch.vue b/src/components/Switch/SSwitch.vue new file mode 100644 index 00000000..37bdb26c --- /dev/null +++ b/src/components/Switch/SSwitch.vue @@ -0,0 +1,93 @@ + + + diff --git a/src/components/Switch/index.ts b/src/components/Switch/index.ts new file mode 100644 index 00000000..2040039d --- /dev/null +++ b/src/components/Switch/index.ts @@ -0,0 +1,3 @@ +import SSwitch from './SSwitch.vue' + +export { SSwitch } diff --git a/src/components/index.ts b/src/components/index.ts index 573e5ba2..b5be4cd7 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -23,6 +23,7 @@ import { SInput, SJsonInput } from './Input' import { SMain } from './Layout/Main' import { SMenu, SMenuItem, SMenuItemGroup, SSubmenu } from './Menu' import { SPagination } from './Pagination' +import { SSwitch } from './Switch' import { SRadio } from './Radio' import { SRow } from './Layout/Row' import { SScrollSectionItem, SScrollSections } from './ScrollSections' @@ -69,6 +70,7 @@ export { SScrollSections, SSelect, SSubmenu, + SSwitch, STab, STabs, STable, diff --git a/src/index.ts b/src/index.ts index ba537aae..c012779e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,6 +38,7 @@ import { SScrollSections, SSelect, SSubmenu, + SSwitch, STab, STabs, STable, @@ -87,6 +88,7 @@ const components = [ { component: SScrollSections, name: Components.SScrollSections }, { component: SSelect, name: Components.SSelect }, { component: SSubmenu, name: Components.SSubmenu }, + { component: SSwitch, name: Components.SSwitch }, { component: STab, name: Components.STab }, { component: STabs, name: Components.STabs }, { component: STable, name: Components.STable }, @@ -152,6 +154,7 @@ export { SScrollSections, SSelect, SSubmenu, + SSwitch, STab, STabs, STable, diff --git a/src/stories/SSwitch.stories.ts b/src/stories/SSwitch.stories.ts new file mode 100644 index 00000000..7ad0ef19 --- /dev/null +++ b/src/stories/SSwitch.stories.ts @@ -0,0 +1,61 @@ +import { color, text, number, boolean, withKnobs } from '@storybook/addon-knobs' + +import { SSwitch } from '../components/Switch' + +export default { + component: SSwitch, + title: 'Design System/Components/Switch', + decorators: [withKnobs], + excludeStories: /.*Data$/ +} + +export const configurable = () => ({ + components: { SSwitch }, + template: `
+ + + v-model="{{ modelValue }}", @change="{{ changeValue }}" + +
`, + data: () => ({ + modelValue: true, + changeValue: true + }), + props: { + activeColor: { + default: color('Active Background Color', 'rgb(208, 2, 27)') + }, + inactiveColor: { + default: color('Inactive Background Color', 'rgb(246, 204, 209)') + }, + activeText: { + default: text('Active Text', '') + }, + inactiveText: { + default: text('Inactive Text', '') + }, + activeValue: { + default: text('Active Value', 'Active Value') + }, + inactiveValue: { + default: text('Inactive Value', 'Inactive Value') + }, + width: { + default: number('Width', 40) + }, + disabled: { + default: boolean('Disabled', false) + } + } +}) diff --git a/src/styles/index.scss b/src/styles/index.scss index 9b2002d7..12bc8763 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -18,6 +18,7 @@ @import "./radio"; @import "./scroll-sections"; @import "./select"; +@import "./switch"; @import "./tabs"; @import "./table"; @import "./tooltip"; diff --git a/src/styles/switch.scss b/src/styles/switch.scss new file mode 100644 index 00000000..7db1a641 --- /dev/null +++ b/src/styles/switch.scss @@ -0,0 +1,10 @@ +@import "./variables"; + +.s-switch { + .el-switch__label { + color: var(--s-color-basic-black); + &.is-active { + color: var(--s-color-main-brand); + } + } +} diff --git a/src/types/components.ts b/src/types/components.ts index 3c4d1a20..7c180c2f 100644 --- a/src/types/components.ts +++ b/src/types/components.ts @@ -36,6 +36,7 @@ export enum Components { SScrollSections = 'SScrollSections', SSelect = 'SSelect', SSubmenu = 'SSubmenu', + SSwitch = 'SSwitch', STab = 'STab', STabs = 'STabs', STable = 'STable', From 067d76c03284306e3f709136119b91675353c4f8 Mon Sep 17 00:00:00 2001 From: Alex Natalia <38787212+alexnatalia@users.noreply.github.com> Date: Tue, 20 Oct 2020 13:17:51 +0300 Subject: [PATCH 2/3] Slider component (#67) Added Slider component and story. --- package.json | 2 +- src/components/Slider/SSlider.vue | 130 +++++++++++++++++++++ src/components/Slider/index.ts | 3 + src/components/Switch/SSwitch.vue | 3 +- src/components/index.ts | 2 + src/index.ts | 3 + src/stories/SSlider.stories.ts | 185 ++++++++++++++++++++++++++++++ src/styles/index.scss | 1 + src/styles/slider.scss | 97 ++++++++++++++++ src/styles/variables.scss | 1 + src/types/components.ts | 1 + 11 files changed, 425 insertions(+), 3 deletions(-) create mode 100644 src/components/Slider/SSlider.vue create mode 100644 src/components/Slider/index.ts create mode 100644 src/stories/SSlider.stories.ts create mode 100644 src/styles/slider.scss diff --git a/package.json b/package.json index d2d00eac..29ac3ab9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.4.1", + "version": "0.4.2", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/components/Slider/SSlider.vue b/src/components/Slider/SSlider.vue new file mode 100644 index 00000000..8baf9a3b --- /dev/null +++ b/src/components/Slider/SSlider.vue @@ -0,0 +1,130 @@ + + + diff --git a/src/components/Slider/index.ts b/src/components/Slider/index.ts new file mode 100644 index 00000000..b78fc957 --- /dev/null +++ b/src/components/Slider/index.ts @@ -0,0 +1,3 @@ +import SSlider from './SSlider.vue' + +export { SSlider } diff --git a/src/components/Switch/SSwitch.vue b/src/components/Switch/SSwitch.vue index 37bdb26c..b490404f 100644 --- a/src/components/Switch/SSwitch.vue +++ b/src/components/Switch/SSwitch.vue @@ -1,7 +1,6 @@