web-counter-rust/templates/index.html

30 lines
1.2 KiB
HTML
Raw Permalink Normal View History

2024-01-20 12:02:46 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/htmx.org@1.9.10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script>
</head>
<body>
<div class="flex flex-col items-center justify-center h-screen bg-gray-100 dark:bg-gray-900">
<div class="text-center">
{{ counter }}
<p class="text-xl text-gray-600 dark:text-gray-400">
Click the buttons to increase or decrease the counter
</p>
</div>
<div class="mt-8 flex gap-4">
<button hx-post="/api/increment" hx-target="#counter" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50">
Increment
</button>
<button hx-post="/api/decrement" hx-target="#counter" class="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50">
Decrement
</button>
</div>
</div>
</body>
</html>