feat: complete tasks 1 to 15
This commit is contained in:
+424
@@ -0,0 +1,424 @@
|
||||
// main.js
|
||||
|
||||
// Function to update weather widget
|
||||
async function updateWeather() {
|
||||
try {
|
||||
const res = await fetch("/api/weather");
|
||||
if (!res.ok) throw new Error("Failed to fetch weather");
|
||||
const data = await res.json();
|
||||
const weatherDiv = document.getElementById("weather-widget");
|
||||
if (!weatherDiv) return;
|
||||
// Set temperature
|
||||
weatherDiv.querySelector(".weather-temp").textContent = `${data.temp_c} °C`;
|
||||
// Set icon
|
||||
const icon = weatherDiv.querySelector(".weather-icon");
|
||||
if (data.condition === "sunny") {
|
||||
icon.src = "https://cdn-icons-png.flaticon.com/512/869/869869.png";
|
||||
icon.alt = "Sunny";
|
||||
} else if (data.condition === "rain") {
|
||||
icon.src = "https://cdn-icons-png.flaticon.com/512/414/414974.png";
|
||||
icon.alt = "Rainy";
|
||||
} else if (data.condition === "snow") {
|
||||
icon.src = "https://cdn-icons-png.flaticon.com/512/642/642102.png";
|
||||
icon.alt = "Snowy";
|
||||
}
|
||||
} catch (err) {
|
||||
// Show error in widget
|
||||
const weatherDiv = document.getElementById("weather-widget");
|
||||
if (weatherDiv) {
|
||||
weatherDiv.querySelector(".weather-temp").textContent = "N/A";
|
||||
weatherDiv.querySelector(".weather-icon").src = "";
|
||||
weatherDiv.querySelector(".weather-icon").alt = "Error";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initial load
|
||||
updateWeather();
|
||||
// Update every 5 minutes
|
||||
setInterval(updateWeather, 5 * 60 * 1000);
|
||||
|
||||
// --- Time Widget Logic ---
|
||||
// Time zone offsets in hours relative to UTC
|
||||
const timeZones = {
|
||||
london: 0, // UTC+0 (BST not handled for simplicity)
|
||||
est: -4, // UTC-4 (EDT, adjust for DST if needed)
|
||||
nigeria: 1, // UTC+1
|
||||
pakistan: 5, // UTC+5
|
||||
};
|
||||
|
||||
function pad(n) {
|
||||
return n < 10 ? "0" + n : n;
|
||||
}
|
||||
|
||||
async function updateClocks() {
|
||||
try {
|
||||
const res = await fetch("/api/utc");
|
||||
if (!res.ok) throw new Error("Failed to fetch UTC time");
|
||||
const { utc } = await res.json();
|
||||
const utcDate = new Date(utc);
|
||||
// Update each clock
|
||||
for (const [zone, offset] of Object.entries(timeZones)) {
|
||||
const local = new Date(utcDate.getTime() + offset * 60 * 60 * 1000);
|
||||
const h = pad(local.getUTCHours());
|
||||
const m = pad(local.getUTCMinutes());
|
||||
const s = pad(local.getUTCSeconds());
|
||||
const el = document.getElementById(`${zone}-clock`);
|
||||
if (el) el.textContent = `${h}:${m}:${s}`;
|
||||
}
|
||||
} catch (err) {
|
||||
// Show error in all clocks
|
||||
for (const zone of Object.keys(timeZones)) {
|
||||
const el = document.getElementById(`${zone}-clock`);
|
||||
if (el) el.textContent = "N/A";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initial load and update every second
|
||||
updateClocks();
|
||||
setInterval(updateClocks, 1000);
|
||||
|
||||
// --- Airport Autocomplete ---
|
||||
// const airportInput = document.querySelector('input[placeholder*="airport"]');
|
||||
// let dropdownDiv;
|
||||
// if (airportInput) {
|
||||
// console.log("hi");
|
||||
// dropdownDiv = document.createElement("div");
|
||||
// dropdownDiv.className =
|
||||
// "absolute bg-white border border-gray-300 rounded shadow z-10 w-full max-h-48 overflow-y-auto top-[calc(100%+10px)]";
|
||||
// dropdownDiv.style.display = "none";
|
||||
// airportInput.parentNode.appendChild(dropdownDiv);
|
||||
// airportInput.addEventListener("input", async function () {
|
||||
// const val = airportInput.value.trim();
|
||||
// if (val.length < 3) {
|
||||
// dropdownDiv.style.display = "none";
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
// const res = await fetch(`/airports?search=${encodeURIComponent(val)}`);
|
||||
// if (!res.ok) throw new Error("Failed to fetch airports");
|
||||
// const airports = await res.json();
|
||||
// if (!Array.isArray(airports) || airports.length === 0) {
|
||||
// dropdownDiv.innerHTML =
|
||||
// '<div class="p-2 text-gray-500">No results</div>';
|
||||
// dropdownDiv.style.display = "block";
|
||||
// return;
|
||||
// }
|
||||
// dropdownDiv.innerHTML = airports
|
||||
// .map(
|
||||
// (a, i) =>
|
||||
// `<div class="p-2 hover:bg-sky-100 cursor-pointer" data-index="${i}">${a.name}</div>`
|
||||
// )
|
||||
// .join("");
|
||||
// dropdownDiv.style.display = "block";
|
||||
// Array.from(dropdownDiv.children).forEach((child, i) => {
|
||||
// child.addEventListener("click", () => {
|
||||
// airportInput.value = child.textContent;
|
||||
// dropdownDiv.style.display = "none";
|
||||
// selectedAirport = airports[i];
|
||||
// console.log("hey");
|
||||
// airportInput.textContent = `hold`;
|
||||
// if (selectedAirport) {
|
||||
// console.log(selectedAirport);
|
||||
// airportInput.value = `${selectedAirport.name} (${selectedAirport.code})`;
|
||||
// showMap(
|
||||
// Number(selectedAirport.latitude_deg),
|
||||
// Number(selectedAirport.longitude_deg)
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// } catch (err) {
|
||||
// dropdownDiv.innerHTML =
|
||||
// '<div class="p-2 text-red-500">Error loading airports</div>';
|
||||
// dropdownDiv.style.display = "block";
|
||||
// }
|
||||
// });
|
||||
// // Hide dropdown on blur
|
||||
// airportInput.addEventListener("blur", () =>
|
||||
// setTimeout(() => (dropdownDiv.style.display = "none"), 200)
|
||||
// );
|
||||
// }
|
||||
|
||||
// --- Airport Autocomplete ---
|
||||
const airportInput = document.querySelector('input[placeholder*="airport"]');
|
||||
let dropdownDiv;
|
||||
let selectedAirport; // Declare globally to store selection
|
||||
|
||||
if (airportInput) {
|
||||
dropdownDiv = document.createElement("div");
|
||||
dropdownDiv.className =
|
||||
"absolute bg-white border border-gray-300 rounded shadow z-10 w-full max-h-48 overflow-y-auto top-[calc(100%+10px)]";
|
||||
dropdownDiv.style.display = "none";
|
||||
dropdownDiv.setAttribute("role", "listbox"); // ARIA role
|
||||
airportInput.parentNode.appendChild(dropdownDiv);
|
||||
|
||||
// Event Delegation for dropdown clicks (fixes listener duplication)
|
||||
dropdownDiv.addEventListener("click", (e) => {
|
||||
const item = e.target.closest("[data-index]");
|
||||
if (!item) return;
|
||||
|
||||
const index = item.dataset.index;
|
||||
selectedAirport = currentAirports[index]; // Use latest fetched data
|
||||
airportInput.value = `${selectedAirport.name} (${selectedAirport.code})`; // Set once
|
||||
|
||||
// showMap(
|
||||
// Number(selectedAirport.latitude_deg),
|
||||
// Number(selectedAirport.longitude_deg)
|
||||
// );
|
||||
onAirportSelected(selectedAirport);
|
||||
dropdownDiv.style.display = "none";
|
||||
});
|
||||
|
||||
// Debounce input (300ms delay)
|
||||
let debounceTimer;
|
||||
let currentAirports = []; // Track latest results
|
||||
|
||||
airportInput.addEventListener("input", async function () {
|
||||
clearTimeout(debounceTimer);
|
||||
debounceTimer = setTimeout(async () => {
|
||||
const val = airportInput.value.trim();
|
||||
if (val.length < 3) {
|
||||
dropdownDiv.style.display = "none";
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch(`/airports?search=${encodeURIComponent(val)}`);
|
||||
if (!res.ok) throw new Error("Failed to fetch");
|
||||
const airports = await res.json();
|
||||
currentAirports = airports; // Store for click handler
|
||||
|
||||
if (!airports.length) {
|
||||
dropdownDiv.innerHTML =
|
||||
'<div class="p-2 text-gray-500">No results</div>';
|
||||
dropdownDiv.style.display = "block";
|
||||
return;
|
||||
}
|
||||
|
||||
// Escape HTML to prevent XSS
|
||||
dropdownDiv.innerHTML = airports
|
||||
.map((a, i) => {
|
||||
const name = a.name.replace(
|
||||
/[&<>]/g,
|
||||
(c) => ({ "&": "&", "<": "<", ">": ">" }[c])
|
||||
);
|
||||
return `<div class="p-2 hover:bg-sky-100 cursor-pointer"
|
||||
data-index="${i}"
|
||||
role="option"
|
||||
aria-label="${name} (${a.code})">
|
||||
${name}
|
||||
</div>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
dropdownDiv.style.display = "block";
|
||||
} catch (err) {
|
||||
dropdownDiv.innerHTML =
|
||||
'<div class="p-2 text-red-500">Error loading airports</div>';
|
||||
dropdownDiv.style.display = "block";
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
|
||||
// Hide dropdown only when focus leaves input/dropdown
|
||||
document.addEventListener("click", (e) => {
|
||||
if (!airportInput.contains(e.target) && !dropdownDiv.contains(e.target)) {
|
||||
dropdownDiv.style.display = "none";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// --- Map Widget Logic ---
|
||||
// let selectedAirport = null;
|
||||
function showMap(lat, lon) {
|
||||
console.log(lat, lon);
|
||||
const mapDiv = document.getElementById("map-widget");
|
||||
if (!mapDiv) return;
|
||||
mapDiv.innerHTML = "";
|
||||
mapDiv.style.height = "200px";
|
||||
mapDiv.style.width = "300px";
|
||||
// OpenLayers map
|
||||
if (window.ol && window.ol.Map) {
|
||||
new ol.Map({
|
||||
target: mapDiv,
|
||||
layers: [new ol.layer.Tile({ source: new ol.source.OSM() })],
|
||||
view: new ol.View({
|
||||
center: ol.proj.fromLonLat([-79.6248, 43.6532]),
|
||||
zoom: 13,
|
||||
}),
|
||||
});
|
||||
} else {
|
||||
mapDiv.innerHTML =
|
||||
'<div class="text-center text-gray-500">Map library not loaded</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// --- Distance from Arctic Circle Widget ---
|
||||
function haversine(lat1, lon1, lat2, lon2) {
|
||||
const toRad = (deg) => (deg * Math.PI) / 180;
|
||||
const R = 6371; // Earth radius in km
|
||||
const dLat = toRad(lat2 - lat1);
|
||||
const dLon = toRad(lon2 - lon1);
|
||||
const a =
|
||||
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(toRad(lat1)) *
|
||||
Math.cos(toRad(lat2)) *
|
||||
Math.sin(dLon / 2) *
|
||||
Math.sin(dLon / 2);
|
||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
return R * c;
|
||||
}
|
||||
|
||||
function updateDistanceWidget(lat, lon) {
|
||||
const distDiv = document.getElementById("distance-widget");
|
||||
if (!distDiv) return;
|
||||
// Arctic Circle: latitude 66.56333, longitude 0
|
||||
const arcticLat = 66.56333;
|
||||
const arcticLon = 0;
|
||||
const dist = haversine(arcticLat, arcticLon, lat, lon);
|
||||
distDiv.textContent = dist.toFixed(1) + " KM";
|
||||
}
|
||||
|
||||
// Update distance when airport is selected
|
||||
function onAirportSelected(airport) {
|
||||
if (
|
||||
airport &&
|
||||
airport.latitude_deg &&
|
||||
airport.longitude_deg &&
|
||||
!isNaN(Number(airport.latitude_deg)) &&
|
||||
!isNaN(Number(airport.longitude_deg))
|
||||
) {
|
||||
showMap(Number(airport.latitude_deg), Number(airport.longitude_deg));
|
||||
updateDistanceWidget(
|
||||
Number(airport.latitude_deg),
|
||||
Number(airport.longitude_deg)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Analytic Logging ---
|
||||
function logWidgetClick(widgetName) {
|
||||
fetch("/analytic", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
widget_name: widgetName,
|
||||
browser_type: navigator.userAgent,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// --- Click Counter Widget ---
|
||||
async function updateClickCounter() {
|
||||
try {
|
||||
const res = await fetch("/analytic/count");
|
||||
if (!res.ok) throw new Error("Failed to fetch count");
|
||||
const { count } = await res.json();
|
||||
const el = document.getElementById("click-counter-widget");
|
||||
if (el) el.textContent = count;
|
||||
} catch (err) {
|
||||
const el = document.getElementById("click-counter-widget");
|
||||
if (el) el.textContent = "N/A";
|
||||
}
|
||||
}
|
||||
updateClickCounter();
|
||||
setInterval(updateClickCounter, 60 * 1000);
|
||||
|
||||
// --- Export XML Widget ---
|
||||
const exportBtn = document.querySelector(
|
||||
"button.bg-sky-400.text-white.font-semibold.px-8.py-2.rounded"
|
||||
);
|
||||
if (exportBtn && exportBtn.textContent.trim().toLowerCase() === "export") {
|
||||
exportBtn.addEventListener("click", function () {
|
||||
window.location.href = "/analytic/export";
|
||||
});
|
||||
}
|
||||
|
||||
// --- Reddit News Widget ---
|
||||
async function updateRedditNews() {
|
||||
try {
|
||||
const res = await fetch("/reddit");
|
||||
if (!res.ok) throw new Error("Failed to fetch reddit");
|
||||
const posts = await res.json();
|
||||
const newsDiv = document.getElementById("news-widget");
|
||||
if (!newsDiv) return;
|
||||
newsDiv.innerHTML = posts
|
||||
.map(
|
||||
(post) => `
|
||||
<div class="bg-gray-100 p-2 rounded mb-2">
|
||||
<a href="${post.url}" target="_blank" class="font-semibold text-blue-700 hover:underline">${post.title}</a>
|
||||
<div class="text-xs text-gray-500">by ${post.author}</div>
|
||||
</div>
|
||||
`
|
||||
)
|
||||
.join("");
|
||||
} catch (err) {
|
||||
const newsDiv = document.getElementById("news-widget");
|
||||
if (newsDiv)
|
||||
newsDiv.innerHTML = '<div class="text-red-500">Failed to load news</div>';
|
||||
}
|
||||
}
|
||||
updateRedditNews();
|
||||
|
||||
// --- Coin Calculator Widget ---
|
||||
const coinInput = document.querySelector('input[placeholder*="coin"]');
|
||||
const coinBtn = document.querySelector(
|
||||
"button.bg-sky-400.text-white.font-semibold.px-8.py-2.rounded.mt-2"
|
||||
);
|
||||
const coinResult = document.getElementById("coin-result-list");
|
||||
if (coinInput && coinBtn && coinResult) {
|
||||
coinBtn.addEventListener("click", async function () {
|
||||
const val = coinInput.value.trim();
|
||||
if (!val || isNaN(val) || Number(val) < 0) {
|
||||
coinResult.innerHTML =
|
||||
'<li class="text-red-500">Enter a valid amount</li>';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await fetch("/coin-calc", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ amount: val }),
|
||||
});
|
||||
if (!res.ok) throw new Error("Failed to calculate");
|
||||
const data = await res.json();
|
||||
coinResult.innerHTML = data
|
||||
.map((c) => `<li>${c.count} x $${c.denomination}</li>`)
|
||||
.join("");
|
||||
} catch (err) {
|
||||
coinResult.innerHTML =
|
||||
'<li class="text-red-500">Error calculating coins</li>';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Attach click listeners to widgets
|
||||
function attachAnalyticListeners() {
|
||||
const widgets = [
|
||||
{ id: "weather-widget", name: "weather" },
|
||||
{ id: "nigeria-clock", name: "nigeria-clock" },
|
||||
{ id: "london-clock", name: "london-clock" },
|
||||
{ id: "est-clock", name: "est-clock" },
|
||||
{ id: "pakistan-clock", name: "pakistan-clock" },
|
||||
{ id: "map-widget", name: "map" },
|
||||
{ id: "distance-widget", name: "distance" },
|
||||
{ id: "airport-autocomplete", name: "airport-autocomplete" },
|
||||
{ id: "click-counter-widget", name: "click-counter" },
|
||||
// Add more as needed
|
||||
];
|
||||
widgets.forEach((w) => {
|
||||
const el = document.getElementById(w.id);
|
||||
if (el) {
|
||||
el.addEventListener("click", () => logWidgetClick(w.name));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call after DOMContentLoaded
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", attachAnalyticListeners);
|
||||
} else {
|
||||
attachAnalyticListeners();
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
||||
@layer properties;
|
||||
@layer theme, base, components, utilities;
|
||||
@layer theme {
|
||||
:root, :host {
|
||||
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
|
||||
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
||||
"Courier New", monospace;
|
||||
--color-red-500: oklch(63.7% 0.237 25.331);
|
||||
--color-sky-100: oklch(95.1% 0.026 236.824);
|
||||
--color-sky-400: oklch(74.6% 0.16 232.661);
|
||||
--color-blue-100: oklch(93.2% 0.032 255.585);
|
||||
--color-gray-100: oklch(96.7% 0.003 264.542);
|
||||
--color-gray-300: oklch(87.2% 0.01 258.338);
|
||||
--color-gray-500: oklch(55.1% 0.027 264.364);
|
||||
--color-white: #fff;
|
||||
--spacing: 0.25rem;
|
||||
--text-xs: 0.75rem;
|
||||
--text-xs--line-height: calc(1 / 0.75);
|
||||
--text-sm: 0.875rem;
|
||||
--text-sm--line-height: calc(1.25 / 0.875);
|
||||
--text-lg: 1.125rem;
|
||||
--text-lg--line-height: calc(1.75 / 1.125);
|
||||
--text-3xl: 1.875rem;
|
||||
--text-3xl--line-height: calc(2.25 / 1.875);
|
||||
--text-4xl: 2.25rem;
|
||||
--text-4xl--line-height: calc(2.5 / 2.25);
|
||||
--font-weight-medium: 500;
|
||||
--font-weight-semibold: 600;
|
||||
--font-weight-bold: 700;
|
||||
--radius-lg: 0.5rem;
|
||||
--default-font-family: var(--font-sans);
|
||||
--default-mono-font-family: var(--font-mono);
|
||||
}
|
||||
}
|
||||
@layer base {
|
||||
*, ::after, ::before, ::backdrop, ::file-selector-button {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0 solid;
|
||||
}
|
||||
html, :host {
|
||||
line-height: 1.5;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
tab-size: 4;
|
||||
font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
|
||||
font-feature-settings: var(--default-font-feature-settings, normal);
|
||||
font-variation-settings: var(--default-font-variation-settings, normal);
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
hr {
|
||||
height: 0;
|
||||
color: inherit;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
abbr:where([title]) {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
-webkit-text-decoration: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
b, strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
code, kbd, samp, pre {
|
||||
font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
|
||||
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
||||
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
||||
font-size: 1em;
|
||||
}
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
sub, sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
table {
|
||||
text-indent: 0;
|
||||
border-color: inherit;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
:-moz-focusring {
|
||||
outline: auto;
|
||||
}
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
ol, ul, menu {
|
||||
list-style: none;
|
||||
}
|
||||
img, svg, video, canvas, audio, iframe, embed, object {
|
||||
display: block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
img, video {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
button, input, select, optgroup, textarea, ::file-selector-button {
|
||||
font: inherit;
|
||||
font-feature-settings: inherit;
|
||||
font-variation-settings: inherit;
|
||||
letter-spacing: inherit;
|
||||
color: inherit;
|
||||
border-radius: 0;
|
||||
background-color: transparent;
|
||||
opacity: 1;
|
||||
}
|
||||
:where(select:is([multiple], [size])) optgroup {
|
||||
font-weight: bolder;
|
||||
}
|
||||
:where(select:is([multiple], [size])) optgroup option {
|
||||
padding-inline-start: 20px;
|
||||
}
|
||||
::file-selector-button {
|
||||
margin-inline-end: 4px;
|
||||
}
|
||||
::placeholder {
|
||||
opacity: 1;
|
||||
}
|
||||
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
||||
::placeholder {
|
||||
color: currentcolor;
|
||||
@supports (color: color-mix(in lab, red, red)) {
|
||||
color: color-mix(in oklab, currentcolor 50%, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
::-webkit-date-and-time-value {
|
||||
min-height: 1lh;
|
||||
text-align: inherit;
|
||||
}
|
||||
::-webkit-datetime-edit {
|
||||
display: inline-flex;
|
||||
}
|
||||
::-webkit-datetime-edit-fields-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
|
||||
padding-block: 0;
|
||||
}
|
||||
:-moz-ui-invalid {
|
||||
box-shadow: none;
|
||||
}
|
||||
button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {
|
||||
appearance: button;
|
||||
}
|
||||
::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
[hidden]:where(:not([hidden="until-found"])) {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
@layer utilities {
|
||||
.absolute {
|
||||
position: absolute;
|
||||
}
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
.top-\[calc\(100\%\+10px\)\] {
|
||||
top: calc(100% + 10px);
|
||||
}
|
||||
.z-10 {
|
||||
z-index: 10;
|
||||
}
|
||||
.col-span-1 {
|
||||
grid-column: span 1 / span 1;
|
||||
}
|
||||
.row-span-2 {
|
||||
grid-row: span 2 / span 2;
|
||||
}
|
||||
.mt-2 {
|
||||
margin-top: calc(var(--spacing) * 2);
|
||||
}
|
||||
.mt-8 {
|
||||
margin-top: calc(var(--spacing) * 8);
|
||||
}
|
||||
.mb-1 {
|
||||
margin-bottom: calc(var(--spacing) * 1);
|
||||
}
|
||||
.mb-2 {
|
||||
margin-bottom: calc(var(--spacing) * 2);
|
||||
}
|
||||
.ml-2 {
|
||||
margin-left: calc(var(--spacing) * 2);
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
}
|
||||
.table {
|
||||
display: table;
|
||||
}
|
||||
.h-24 {
|
||||
height: calc(var(--spacing) * 24);
|
||||
}
|
||||
.h-244 {
|
||||
height: calc(var(--spacing) * 244);
|
||||
}
|
||||
.h-full {
|
||||
height: 100%;
|
||||
}
|
||||
.h-max {
|
||||
height: max-content;
|
||||
}
|
||||
.max-h-48 {
|
||||
max-height: calc(var(--spacing) * 48);
|
||||
}
|
||||
.max-h-\[300px\] {
|
||||
max-height: 300px;
|
||||
}
|
||||
.min-h-screen {
|
||||
min-height: 100vh;
|
||||
}
|
||||
.w-24 {
|
||||
width: calc(var(--spacing) * 24);
|
||||
}
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
.list-inside {
|
||||
list-style-position: inside;
|
||||
}
|
||||
.list-disc {
|
||||
list-style-type: disc;
|
||||
}
|
||||
.grid-cols-5 {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
}
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
.items-center {
|
||||
align-items: center;
|
||||
}
|
||||
.justify-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.gap-8 {
|
||||
gap: calc(var(--spacing) * 8);
|
||||
}
|
||||
.space-y-2 {
|
||||
:where(& > :not(:last-child)) {
|
||||
--tw-space-y-reverse: 0;
|
||||
margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));
|
||||
margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));
|
||||
}
|
||||
}
|
||||
.overflow-y-auto {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.rounded-lg {
|
||||
border-radius: var(--radius-lg);
|
||||
}
|
||||
.border {
|
||||
border-style: var(--tw-border-style);
|
||||
border-width: 1px;
|
||||
}
|
||||
.border-gray-300 {
|
||||
border-color: var(--color-gray-300);
|
||||
}
|
||||
.bg-blue-100 {
|
||||
background-color: var(--color-blue-100);
|
||||
}
|
||||
.bg-gray-100 {
|
||||
background-color: var(--color-gray-100);
|
||||
}
|
||||
.bg-inherit {
|
||||
background-color: inherit;
|
||||
}
|
||||
.bg-sky-400 {
|
||||
background-color: var(--color-sky-400);
|
||||
}
|
||||
.bg-white {
|
||||
background-color: var(--color-white);
|
||||
}
|
||||
.p-2 {
|
||||
padding: calc(var(--spacing) * 2);
|
||||
}
|
||||
.p-4 {
|
||||
padding: calc(var(--spacing) * 4);
|
||||
}
|
||||
.p-6 {
|
||||
padding: calc(var(--spacing) * 6);
|
||||
}
|
||||
.p-8 {
|
||||
padding: calc(var(--spacing) * 8);
|
||||
}
|
||||
.px-8 {
|
||||
padding-inline: calc(var(--spacing) * 8);
|
||||
}
|
||||
.py-2 {
|
||||
padding-block: calc(var(--spacing) * 2);
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
.font-mono {
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.text-3xl {
|
||||
font-size: var(--text-3xl);
|
||||
line-height: var(--tw-leading, var(--text-3xl--line-height));
|
||||
}
|
||||
.text-4xl {
|
||||
font-size: var(--text-4xl);
|
||||
line-height: var(--tw-leading, var(--text-4xl--line-height));
|
||||
}
|
||||
.text-lg {
|
||||
font-size: var(--text-lg);
|
||||
line-height: var(--tw-leading, var(--text-lg--line-height));
|
||||
}
|
||||
.text-sm {
|
||||
font-size: var(--text-sm);
|
||||
line-height: var(--tw-leading, var(--text-sm--line-height));
|
||||
}
|
||||
.text-xs {
|
||||
font-size: var(--text-xs);
|
||||
line-height: var(--tw-leading, var(--text-xs--line-height));
|
||||
}
|
||||
.font-bold {
|
||||
--tw-font-weight: var(--font-weight-bold);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
.font-medium {
|
||||
--tw-font-weight: var(--font-weight-medium);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
.font-semibold {
|
||||
--tw-font-weight: var(--font-weight-semibold);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
.text-gray-500 {
|
||||
color: var(--color-gray-500);
|
||||
}
|
||||
.text-red-500 {
|
||||
color: var(--color-red-500);
|
||||
}
|
||||
.text-white {
|
||||
color: var(--color-white);
|
||||
}
|
||||
.shadow {
|
||||
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
||||
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
||||
}
|
||||
.shadow-md {
|
||||
--tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
||||
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
||||
}
|
||||
.blur {
|
||||
--tw-blur: blur(8px);
|
||||
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
||||
}
|
||||
.outline-none {
|
||||
--tw-outline-style: none;
|
||||
outline-style: none;
|
||||
}
|
||||
.hover\:bg-sky-100 {
|
||||
&:hover {
|
||||
@media (hover: hover) {
|
||||
background-color: var(--color-sky-100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@property --tw-space-y-reverse {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: 0;
|
||||
}
|
||||
@property --tw-border-style {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: solid;
|
||||
}
|
||||
@property --tw-font-weight {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-shadow {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: 0 0 #0000;
|
||||
}
|
||||
@property --tw-shadow-color {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-shadow-alpha {
|
||||
syntax: "<percentage>";
|
||||
inherits: false;
|
||||
initial-value: 100%;
|
||||
}
|
||||
@property --tw-inset-shadow {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: 0 0 #0000;
|
||||
}
|
||||
@property --tw-inset-shadow-color {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-inset-shadow-alpha {
|
||||
syntax: "<percentage>";
|
||||
inherits: false;
|
||||
initial-value: 100%;
|
||||
}
|
||||
@property --tw-ring-color {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-ring-shadow {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: 0 0 #0000;
|
||||
}
|
||||
@property --tw-inset-ring-color {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-inset-ring-shadow {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: 0 0 #0000;
|
||||
}
|
||||
@property --tw-ring-inset {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-ring-offset-width {
|
||||
syntax: "<length>";
|
||||
inherits: false;
|
||||
initial-value: 0px;
|
||||
}
|
||||
@property --tw-ring-offset-color {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: #fff;
|
||||
}
|
||||
@property --tw-ring-offset-shadow {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
initial-value: 0 0 #0000;
|
||||
}
|
||||
@property --tw-blur {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-brightness {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-contrast {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-grayscale {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-hue-rotate {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-invert {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-opacity {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-saturate {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-sepia {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-drop-shadow {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-drop-shadow-color {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@property --tw-drop-shadow-alpha {
|
||||
syntax: "<percentage>";
|
||||
inherits: false;
|
||||
initial-value: 100%;
|
||||
}
|
||||
@property --tw-drop-shadow-size {
|
||||
syntax: "*";
|
||||
inherits: false;
|
||||
}
|
||||
@layer properties {
|
||||
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
||||
*, ::before, ::after, ::backdrop {
|
||||
--tw-space-y-reverse: 0;
|
||||
--tw-border-style: solid;
|
||||
--tw-font-weight: initial;
|
||||
--tw-shadow: 0 0 #0000;
|
||||
--tw-shadow-color: initial;
|
||||
--tw-shadow-alpha: 100%;
|
||||
--tw-inset-shadow: 0 0 #0000;
|
||||
--tw-inset-shadow-color: initial;
|
||||
--tw-inset-shadow-alpha: 100%;
|
||||
--tw-ring-color: initial;
|
||||
--tw-ring-shadow: 0 0 #0000;
|
||||
--tw-inset-ring-color: initial;
|
||||
--tw-inset-ring-shadow: 0 0 #0000;
|
||||
--tw-ring-inset: initial;
|
||||
--tw-ring-offset-width: 0px;
|
||||
--tw-ring-offset-color: #fff;
|
||||
--tw-ring-offset-shadow: 0 0 #0000;
|
||||
--tw-blur: initial;
|
||||
--tw-brightness: initial;
|
||||
--tw-contrast: initial;
|
||||
--tw-grayscale: initial;
|
||||
--tw-hue-rotate: initial;
|
||||
--tw-invert: initial;
|
||||
--tw-opacity: initial;
|
||||
--tw-saturate: initial;
|
||||
--tw-sepia: initial;
|
||||
--tw-drop-shadow: initial;
|
||||
--tw-drop-shadow-color: initial;
|
||||
--tw-drop-shadow-alpha: 100%;
|
||||
--tw-drop-shadow-size: initial;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1 @@
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00B7FF;
|
||||
}
|
||||
@import "tailwindcss";
|
||||
|
||||
Reference in New Issue
Block a user