Skip to content

Instantly share code, notes, and snippets.

@DJanoskova
Created November 8, 2019 14:55
Show Gist options
  • Select an option

  • Save DJanoskova/c83c42c77ac2fd5784a3ff2ffae7a195 to your computer and use it in GitHub Desktop.

Select an option

Save DJanoskova/c83c42c77ac2fd5784a3ff2ffae7a195 to your computer and use it in GitHub Desktop.
<template>
<div :class="classes">
<span class="block sm:inline">{{ text }}</span>
</div>
</template>
<script>
export default {
props: {
type: {
type: String,
value: 'error' | 'info' | 'success' | 'warning'
},
text: String
},
computed: {
color () {
switch (this.type) {
case 'error':
return 'red'
case 'success':
return 'teal'
case 'warning':
return 'orange'
case 'info':
default:
return 'gray'
}
},
classes () {
const { color } = this
return [`bg-${color}-400 border border-${color}-200 text-white px-4 py-3 rounded-lg relative`]
}
},
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment