-
Notifications
You must be signed in to change notification settings - Fork 152
/
Alert.vue
111 lines (105 loc) · 2.39 KB
/
Alert.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<template>
<div class="p-4 mt-4 mb-4 rounded-lg alert text-sm leading-relaxed" :class="[type]">
<div class="flex items-start">
<div class="flex-grow alert-content">
<Markdown unwrap="p" />
</div>
</div>
</div>
</template>
<script>
import { defineComponent } from '@nuxtjs/composition-api'
import { Markdown } from '~docus/utils'
export default defineComponent({
components: { Markdown },
props: {
/**
* @values info, success, warning, danger
*/
type: {
type: String,
default: 'info',
validator(value) {
return ['info', 'success', 'warning', 'danger'].includes(value)
}
}
}
})
</script>
<style lang="postcss" scoped>
.alert {
&.success {
@apply bg-green-50 dark:bg-green-800 dark:bg-opacity-25 text-green-600 dark:text-green-200;
>>> {
code {
@apply bg-green-100 dark:bg-green-900 dark:bg-opacity-50 shadow-none text-current;
}
a:hover {
code {
@apply border-green-400 dark:border-green-700;
}
}
}
}
&.info {
@apply bg-blue-50 dark:bg-blue-800 dark:bg-opacity-25 text-blue-600 dark:text-blue-200;
>>> {
code {
@apply bg-blue-100 dark:bg-blue-900 dark:bg-opacity-50 shadow-none text-current;
}
a:hover {
code {
@apply border-blue-400 dark:border-blue-700;
}
}
}
}
&.warning {
@apply bg-yellow-50 dark:bg-yellow-800 dark:bg-opacity-25 text-yellow-600 dark:text-yellow-100;
>>> {
code {
@apply bg-yellow-100 dark:bg-yellow-900 dark:bg-opacity-50 shadow-none text-current;
}
a:hover {
code {
@apply border-yellow-400 dark:border-yellow-700;
}
}
}
}
&.danger {
@apply bg-red-50 dark:bg-red-800 dark:bg-opacity-25 text-red-600 dark:text-red-100;
>>> {
code {
@apply bg-red-100 dark:bg-red-900 dark:bg-opacity-50 shadow-none text-current;
}
a:hover {
code {
@apply border-red-400 dark:border-red-700;
}
}
}
}
>>> {
strong {
@apply font-semibold text-current;
}
a {
@apply underline border-none font-semibold text-current;
code {
@apply border border-transparent border-dashed;
}
}
}
}
.alert >>> p {
@apply m-0 !important;
}
.dark .alert {
>>> {
a {
@apply text-current;
}
}
}
</style>