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',