Created
November 8, 2019 14:55
-
-
Save DJanoskova/c83c42c77ac2fd5784a3ff2ffae7a195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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