|
|
@@ -1,19 +1,22 @@
|
|
|
<template>
|
|
|
- <button class="c-button" :class="disabled ? 'disabled' : ''" @click="$emit('click')">
|
|
|
- <span v-if="icon" class="icon">{{icon}}</span>
|
|
|
+ <button class="c-button" :style="style" :class="classList" @click="$emit('click')">
|
|
|
+ <c-icon bold :right="6" v-if="icon" class="icon" :size="22">{{icon}}</c-icon>
|
|
|
<slot></slot>
|
|
|
</button>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import CIcon from '@/components/Basic/CIcon'
|
|
|
+
|
|
|
export default {
|
|
|
- // props: ['icon', 'disabled']
|
|
|
+ components: { CIcon },
|
|
|
+ // props: ['icon', 'noClickWarn']
|
|
|
props: {
|
|
|
icon: {
|
|
|
type: String,
|
|
|
default: null
|
|
|
},
|
|
|
- disabled: {
|
|
|
+ noClickWarn: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
@@ -48,6 +51,37 @@ export default {
|
|
|
noRipple: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
+ },
|
|
|
+ left: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ right: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ style () {
|
|
|
+ return {
|
|
|
+ marginRight: this.right ? this.right + 'px' : null,
|
|
|
+ marginLeft: this.left ? this.left + 'px' : null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ classList () {
|
|
|
+ return [
|
|
|
+ this.text
|
|
|
+ ? (this.theme ? 'c-button-text--' + this.theme : 'c-button-text--normal')
|
|
|
+ : (
|
|
|
+ this.standout
|
|
|
+ ? (this.theme ? 'c-button-standout--' + this.theme : 'c-button-standout--normal')
|
|
|
+ : (this.theme ? 'c-button--' + this.theme : 'c-button--normal')
|
|
|
+ ),
|
|
|
+ this.large ? 'c-button--large' : '',
|
|
|
+ this.small ? 'c-button--small' : '',
|
|
|
+ this.noClickWarn ? 'c-button--disabled' : '',
|
|
|
+ this.block ? 'c-button--block' : ''
|
|
|
+ ]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -55,75 +89,101 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@import '~@/style/theme.scss';
|
|
|
+@import '~@/style/mixin/set-theme.scss';
|
|
|
|
|
|
button {
|
|
|
border: none;
|
|
|
outline: none;
|
|
|
- background: transparent;
|
|
|
-
|
|
|
cursor: pointer;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
|
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
|
|
|
- display: block;
|
|
|
- min-width: 120px;
|
|
|
- height: 40px;
|
|
|
- background: $theme-blue;
|
|
|
- color: white;
|
|
|
+ background: $theme-background-grey;
|
|
|
+ color: $theme-grey;
|
|
|
border-radius: 8px;
|
|
|
font-size: 14px;
|
|
|
- padding: 0 16px;
|
|
|
+ padding: 8px 16px;
|
|
|
font-weight: bold;
|
|
|
+ box-sizing: border-box;
|
|
|
+ transition: .15s;
|
|
|
|
|
|
&:hover {
|
|
|
- background: darken($theme-blue, 5);
|
|
|
+ background: darken($theme-background-grey, 5);
|
|
|
}
|
|
|
|
|
|
&:active {
|
|
|
- background: darken($theme-blue, 10);
|
|
|
+ background: darken($theme-background-grey-darker, 10);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.secondary {
|
|
|
- color: $theme-blue;
|
|
|
- background: $theme-blue-transparent;
|
|
|
- &:hover {
|
|
|
- background: darken($theme-blue-transparent, 5);
|
|
|
- }
|
|
|
-
|
|
|
- &:active {
|
|
|
- background: darken($theme-blue-transparent, 10);
|
|
|
- }
|
|
|
+.c-button--block {
|
|
|
+ display: block;
|
|
|
+ width: 100%;
|
|
|
}
|
|
|
|
|
|
-.warning {
|
|
|
- color: $theme-orange;
|
|
|
- background: $theme-orange-transparent;
|
|
|
- &:hover {
|
|
|
- background: darken($theme-orange-transparent, 5);
|
|
|
- }
|
|
|
+@mixin theme($name, $color, $backgroundColor) {
|
|
|
+ .c-button--#{$name} {
|
|
|
+ color: $color;
|
|
|
+ background: $backgroundColor;
|
|
|
|
|
|
- &:active {
|
|
|
- background: darken($theme-orange-transparent, 10);
|
|
|
+ &:hover {
|
|
|
+ background: darken($backgroundColor, 5);
|
|
|
+ }
|
|
|
+
|
|
|
+ &:active {
|
|
|
+ background: darken($backgroundColor, 10);
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ color: $color;
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+ .c-button-text--#{$name} {
|
|
|
+ color: $color;
|
|
|
+ border-radius: 1000px;
|
|
|
+ background: transparent;
|
|
|
+ transition: .3s;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: $backgroundColor;
|
|
|
+ }
|
|
|
|
|
|
-.error {
|
|
|
- color: $theme-red;
|
|
|
- background: $theme-red-transparent;
|
|
|
- &:hover {
|
|
|
- background: darken($theme-red-transparent, 5);
|
|
|
+ &:active {
|
|
|
+ background: darken($backgroundColor, 5);
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ color: $color;
|
|
|
+ }
|
|
|
}
|
|
|
+ .c-button-standout--#{$name} {
|
|
|
+ color: white;
|
|
|
+ background: $color;
|
|
|
|
|
|
- &:active {
|
|
|
- background: darken($theme-red-transparent, 10);
|
|
|
+ &:hover {
|
|
|
+ background: lighten($color, 5);
|
|
|
+ }
|
|
|
+
|
|
|
+ &:active {
|
|
|
+ background: lighten($color, 10);
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.disabled {
|
|
|
+@include setTheme()
|
|
|
+
|
|
|
+.c-button--disabled {
|
|
|
background: #daeafa;
|
|
|
color: white;
|
|
|
cursor: not-allowed;
|
|
|
+
|
|
|
&:hover {
|
|
|
background: #daeafa;
|
|
|
}
|