Skip to content

Instantly share code, notes, and snippets.

@rosd89
Created January 31, 2020 05:36
Show Gist options
  • Save rosd89/6eaff6e0bca51c068ca0371a30811930 to your computer and use it in GitHub Desktop.
Save rosd89/6eaff6e0bca51c068ca0371a30811930 to your computer and use it in GitHub Desktop.
<template>
<button :class="computedClass">
<slot></slot>
</button>
</template>
<script>
export default {
name: 'ip-button',
props: {
outline: {
type: Boolean,
default: false
},
pill: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
computed: {
computedClass() {
let c = 'btn'
if (this.outline) c += ' btn-outline-blue'
else c += ' btn-blue'
if (this.pill) c += ' rounded-full'
else c += ' rounded'
if (this.disabled) c += ' btn-disabled'
return c
}
}
}
</script>
<style scoped>
.btn {
@apply font-bold py-2 px-4 inline-flex items-center;
}
.btn-blue {
@apply bg-blue-500 text-white;
}
.btn-blue:hover {
@apply bg-blue-700;
}
.btn-outline-blue {
@apply bg-transparent text-blue-700 font-semibold border border-blue-500 rounded;
}
.btn-outline-blue:hover {
@apply bg-blue-500 text-white border-transparent;
}
.btn-disabled {
@apply opacity-50 cursor-not-allowed;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment