mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
add BaseButton component
This commit is contained in:
parent
8f70ce5b31
commit
2c2f69fbf8
@ -3,6 +3,7 @@
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
font-family: inherit;
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
import { storiesOf } from '@storybook/vue'
|
||||
import helpers from '~/storybook/helpers'
|
||||
import BaseButton from './BaseButton.vue'
|
||||
|
||||
storiesOf('BaseButton', module)
|
||||
.addDecorator(helpers.layout)
|
||||
|
||||
.add('Default', () => ({
|
||||
components: { BaseButton },
|
||||
template: '<base-button>Click me</base-button>',
|
||||
}))
|
||||
|
||||
.add('With Icon', () => ({
|
||||
components: { BaseButton },
|
||||
template: '<base-button icon="edit">With Icon</base-button>',
|
||||
}))
|
||||
|
||||
.add('Icon Only', () => ({
|
||||
components: { BaseButton },
|
||||
template: '<base-button icon="trash" />',
|
||||
}))
|
||||
40
webapp/components/_new/generic/BaseButton/BaseButton.vue
Normal file
40
webapp/components/_new/generic/BaseButton/BaseButton.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<button class="base-button">
|
||||
<base-icon v-if="icon" :name="icon" :class="iconClass" />
|
||||
<slot />
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
iconClass() {
|
||||
return this.$slots.default == null ? '--icon-only' : ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.base-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
padding: 0 12px;
|
||||
color: $color-primary;
|
||||
background-color: $color-neutral-90;
|
||||
border: 1px solid $color-primary;
|
||||
border-radius: 6px;
|
||||
font-weight: $font-weight-bold;
|
||||
cursor: pointer;
|
||||
|
||||
> .base-icon:not(.--icon-only) {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user