-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalert-bars.html
More file actions
146 lines (125 loc) · 5.67 KB
/
Copy pathalert-bars.html
File metadata and controls
146 lines (125 loc) · 5.67 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Alert Bars</title>
<!-- MDI Icons -->
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/6.5.95/css/materialdesignicons.min.css" />
<!-- Tailwind -->
<script src="https://cdn-tailwindcss.vercel.app/"></script>
<!-- AlpineJS -->
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.10/clipboard.min.js"></script>
<!-- toastify.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastify-js/1.11.2/toastify.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastify-js/1.11.2/toastify.min.js"></script>
</head>
<body>
<div x-data="" x-init="appInit();" class="flex flex-col items-center justify-center min-h-screen bg-white mt-10 mb-20">
<!-- Notes -->
<div class="flex opacity-50">
<span class="text-center font-bold mb-10 mx-auto">
MDI icons used (npm i @mdi/font)
<hr class="my-4">
<a href="https://egoistdeveloper.github.io/twcss-to-sass-playground/" target="_blank"
class="text-blue-600">
Convert this template to SASS
</a>
<hr class="my-4">
<p>
Hint: Click to copy to clipboard selected alert component.
</p>
</span>
</div>
<template x-for="color in colors">
<!-- Alerts Container -->
<div class="flex flex-row flex-wrap space-x-5 space-y-10">
<template x-for="roundLevel in roundLevels">
<!-- Alert -->
<div class="flex justify-center items-center py-4 px-5 min-w-[350px] max-w-[450px]
rounded-md shadow-sm cursor-default
transition-all duration-100" :class="roundLevel + ' bg-'+color.name+'-200'"
x-data="{ html: getAlertHtml(roundLevel, color) }" :data-clipboard-text="html" id="copy-html"
x-on:click="Toastify({text: 'Component HTML copied to your clipboard.', className: 'success rounded-md'}).showToast()">
<!-- Badge -->
<div class="flex justify-center items-center h-12 w-12 min-w-[50px]"
:class="roundLevel + ' bg-gradient-to-b from-'+color.name+'-100 to-'+color.name+'-300 text-'+color.name+'-800'">
<!-- Icon -->
<i class="mdi mdi-24px" :class="color.icon"></i>
</div>
<div class="flex flex-col px-4">
<!-- Title -->
<h6 class="font-semibold text-base capitalize" :class="'text-'+color.name+'-800"
x-text="color.name"></h6>
<!-- Description -->
<p class="text-sm pt-[5px]" :class="'text-'+color.name+'-700">
Anim irure consectetur duis anim veniam qui...
</p>
</div>
</div>
</template>
</div>
</template>
</div>
<script>
function appInit() {
new ClipboardJS('#copy-html');
}
const roundLevels = [
'rounded-lg',
'rounded-xl',
'rounded-2xl',
'rounded-full',
];
const colors = [{
name: 'emerald',
icon: 'mdi-check-circle-outline'
},
{
name: 'sky',
icon: 'mdi-information-outline'
},
{
name: 'orange',
icon: 'mdi-alert-circle-outline'
},
{
name: 'rose',
icon: 'mdi-close-circle-outline'
},
{
name: 'violet',
icon: 'mdi-help-circle-outline'
}
];
function getAlertHtml(roundLevel, color) {
return `
<!-- Alert -->
<div class="flex justify-center items-center py-4 px-5 min-w-[350px] max-w-[450px]
rounded-md shadow-sm cursor-default
transition-all duration-100 ` + roundLevel + ` bg-` + color.name + `-200">
<!-- Badge -->
<div class="flex justify-center items-center h-12 w-12 min-w-[50px]
` + roundLevel + ` bg-gradient-to-b from-` + color.name + `-100 to-` + color.name +
`-300 text-` + color.name + `-800">
<!-- Icon -->
<i class="mdi mdi-24px" :class="color.icon"></i>
</div>
<div class="flex flex-col px-4">
<!-- Title -->
<h6 class="font-semibold text-base capitalize text-` + color.name + `-800">
` + color.name + `
</h6>
<!-- Description -->
<p class="text-sm pt-[5px] text-` + color.name + `-700">
Anim irure consectetur duis anim veniam qui
</p>
</div>
</div>`;
}
</script>
</body>
</html>