Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@soramitsu/soramitsu-js-ui",
"version": "1.0.47",
"version": "1.1.0",
"private": false,
"publishConfig": {
"registry": "https://nexus.iroha.tech/repository/npm-soramitsu/"
Expand Down
15 changes: 10 additions & 5 deletions src/components/Button/SButton/SButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ export default class SButton extends Mixins(SizeMixin, BorderRadiusMixin, Design
*/
@Prop({ default: TooltipPlacement.TOP, type: String }) readonly tooltipPlacement!: PopoverPlacement

@Inject({ default: '', from: 'elForm' }) elForm!: ElForm
@Inject({ default: '', from: 'elFormItem' }) elFormItem!: ElFormItem
@Inject({ default: '', from: 'elForm' }) private elForm!: ElForm
@Inject({ default: '', from: 'elFormItem' }) private elFormItem!: ElFormItem
@Inject({ default: '', from: 'sButtonGroup' }) private sButtonGroup!: any

private iconLeftOffset = 0
elementIcon = ''
Expand All @@ -130,12 +131,16 @@ export default class SButton extends Mixins(SizeMixin, BorderRadiusMixin, Design
if (this.designSystemClass) {
cssClasses.push(this.designSystemClass)
}
if ((this.elForm || this.elFormItem || {}).size) {
cssClasses.push(`s-${(this.elForm || this.elFormItem).size}`)
const externalSize = (this.elForm || this.elFormItem || this.sButtonGroup || {}).size
if (externalSize) {
cssClasses.push(`s-${externalSize}`)
} else if (this.isStandardSize) {
cssClasses.push(`s-${this.size}`)
}
if (this.isStandardBorderRadius) {
const externalRadius = (this.sButtonGroup || {}).borderRadius
if (externalRadius) {
cssClasses.push(`s-border-radius-${externalRadius}`)
} else if (this.isStandardBorderRadius) {
cssClasses.push(`s-border-radius-${this.borderRadius}`)
}
if ((Object.values(ButtonTypes) as Array<string>).includes(this.type)) {
Expand Down
25 changes: 22 additions & 3 deletions src/components/Button/SButtonGroup/SButtonGroup.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
<template>
<el-button-group>
<el-button-group :class="computedClasses">
<slot></slot>
</el-button-group>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import { Component, Mixins, Provide } from 'vue-property-decorator'
import ElButtonGroup from 'element-ui/lib/button-group'
import DesignSystemInject from '../../DesignSystem/DesignSystemInject'
import SizeMixin from '../../../mixins/SizeMixin'
import BorderRadiusMixin from '../../../mixins/BorderRadiusMixin'

@Component({
components: {
ElButtonGroup
}
})
export default class SButtonGroup extends Vue {}
export default class SButtonGroup extends Mixins(DesignSystemInject, SizeMixin, BorderRadiusMixin) {
@Provide('sButtonGroup') sButtonGroup = this

get computedClasses (): Array<string> {
const cssClasses: Array<string> = []
if (this.designSystemClass) {
cssClasses.push(this.designSystemClass)
}
if (this.isStandardSize) {
cssClasses.push(`s-${this.size}`)
}
if (this.isStandardBorderRadius) {
cssClasses.push(`s-border-radius-${this.borderRadius}`)
}
return cssClasses
}
}
</script>
67 changes: 61 additions & 6 deletions src/stories/SButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,66 @@ export const withIcon16: Story = () => withIcon('refresh-16')
export const withIcon24: Story = () => withIcon('arrows-swap-24')

export const buttonGroup: Story = () => ({
components: { SButton, SButtonGroup, SRow },
template: `<s-row class="s-flex" style="flex: 1; justify-content: space-between; align-items: center;">
<s-button-group>
<s-button type="primary">Append</s-button>
<s-button type="delete">Remove</s-button>
</s-button-group>
components: { SButton, SButtonGroup, SRow, SCol },
template: `<s-row>
<s-col :xs="12" :sm="12" :md="12" :lg="12">
<s-button-group size="big" border-radius="big">
<s-button type="primary">Primary #1</s-button>
<s-button type="primary">Primary #2</s-button>
<s-button type="primary">Primary #3</s-button>
</s-button-group>
</s-col>
<s-col :xs="12" :sm="12" :md="12" :lg="12" style="margin-top: 24px;">
<s-button-group size="big" border-radius="big">
<s-button type="primary" alternative>Primary Alt #1</s-button>
<s-button type="primary" alternative>Primary Alt #2</s-button>
<s-button type="primary" alternative>Primary Alt #3</s-button>
</s-button-group>
</s-col>
<s-col :xs="12" :sm="12" :md="12" :lg="12" style="margin-top: 24px;">
<s-button-group size="big" border-radius="big">
<s-button type="secondary">Secondary #1</s-button>
<s-button type="secondary">Secondary #2</s-button>
<s-button type="secondary">Secondary #3</s-button>
</s-button-group>
</s-col>
<s-col :xs="12" :sm="12" :md="12" :lg="12" style="margin-top: 24px;">
<s-button-group size="big" border-radius="big">
<s-button type="secondary" alternative>Secondary Alt #1</s-button>
<s-button type="secondary" alternative>Secondary Alt #2</s-button>
<s-button type="secondary" alternative>Secondary Alt #3</s-button>
</s-button-group>
</s-col>
<s-col :xs="12" :sm="12" :md="12" :lg="12" style="margin-top: 24px;">
<s-button-group size="big" border-radius="big">
<s-button type="tertiary">Tertiary #1</s-button>
<s-button type="tertiary">Tertiary #2</s-button>
<s-button type="tertiary">Tertiary #3</s-button>
</s-button-group>
</s-col>
<s-col :xs="12" :sm="12" :md="12" :lg="12" style="margin-top: 24px;">
<s-button-group size="big" border-radius="big">
<s-button type="primary">Primary #1</s-button>
<s-button type="secondary">Secondary #2</s-button>
<s-button type="tertiary">Tertiary #3</s-button>
</s-button-group>
</s-col>
<s-col :xs="12" :sm="12" :md="12" :lg="12" style="margin-top: 24px;">
<s-button-group size="big" border-radius="big" style="margin-right: 24px;">
<s-button type="action" icon="basic-circle-plus-24"></s-button>
<s-button type="action" icon="basic-circle-x-24"></s-button>
<s-button type="action" icon="basic-eye-24"></s-button>
</s-button-group>
<s-button-group size="big" border-radius="big" style="margin-right: 24px;">
<s-button type="action" alternative icon="basic-circle-plus-24"></s-button>
<s-button type="action" alternative icon="basic-circle-x-24"></s-button>
<s-button type="action" alternative icon="basic-eye-24"></s-button>
</s-button-group>
<s-button-group size="big" border-radius="big">
<s-button type="action" primary icon="basic-circle-plus-24"></s-button>
<s-button type="action" primary icon="basic-circle-x-24"></s-button>
<s-button type="action" primary icon="basic-eye-24"></s-button>
</s-button-group>
</s-col>
</s-row>`
})
5 changes: 5 additions & 0 deletions src/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ h6,
display: flex;
}

.s-flex-column {
display: flex;
flex-direction: column;
}

.s-bold {
@include font-weight(700);
}
Expand Down
12 changes: 11 additions & 1 deletion src/styles/neumorphism/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ $neu-button-padding-mini: 3px 6px !default;
}
}

.el-button.neumorphic {
button.el-button.neumorphic {
transition: $neu-button-transition;
text-transform: uppercase;

Expand Down Expand Up @@ -359,3 +359,13 @@ $neu-button-padding-mini: 3px 6px !default;
}
}
}

.neumorphic.el-button-group {
box-shadow: var(--s-shadow-element-pressed);
> button.el-button {
box-shadow: none;
}
> .el-button:not(:last-child) {
margin-right: 2px;
}
}