topbar.eta 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <% const timeIcon = `
  2. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  3. <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
  4. <circle cx="12" cy="12" r="10" />
  5. <path d="M12 6v6l4 2" />
  6. </g>
  7. </svg>
  8. ` %>
  9. <% const dateIcon = `
  10. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  11. <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
  12. <path d="M8 2v4m8-4v4" />
  13. <rect width="18" height="18" x="3" y="4" rx="2" />
  14. <path d="M3 10h18M8 14h.01M12 14h.01M16 14h.01M8 18h.01M12 18h.01M16 18h.01" />
  15. </g>
  16. </svg>
  17. ` %>
  18. <% const homeIcon = `
  19. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  20. <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
  21. <path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" />
  22. <path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
  23. </g>
  24. </svg>
  25. ` %>
  26. <% const settingsIcon = `
  27. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  28. <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
  29. <path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" />
  30. <circle cx="12" cy="12" r="3" />
  31. </g>
  32. </svg>
  33. ` %>
  34. <% const usFlag = `
  35. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
  36. <mask id="SVGuywqVbel">
  37. <circle cx="256" cy="256" r="256" fill="#fff" />
  38. </mask>
  39. <g mask="url(#SVGuywqVbel)">
  40. <path fill="#eee" d="M256 0h256v64l-32 32l32 32v64l-32 32l32 32v64l-32 32l32 32v64l-256 32L0 448v-64l32-32l-32-32v-64z" />
  41. <path fill="#d80027" d="M224 64h288v64H224Zm0 128h288v64H256ZM0 320h512v64H0Zm0 128h512v64H0Z" />
  42. <path fill="#0052b4" d="M0 0h256v256H0Z" />
  43. <path fill="#eee" d="m187 243l57-41h-70l57 41l-22-67zm-81 0l57-41H93l57 41l-22-67zm-81 0l57-41H12l57 41l-22-67zm162-81l57-41h-70l57 41l-22-67zm-81 0l57-41H93l57 41l-22-67zm-81 0l57-41H12l57 41l-22-67Zm162-82l57-41h-70l57 41l-22-67Zm-81 0l57-41H93l57 41l-22-67zm-81 0l57-41H12l57 41l-22-67Z" />
  44. </g>
  45. </svg>
  46. ` %>
  47. <% const date = new Date() %>
  48. <header>
  49. <p><%~ timeIcon %> <span id="topbarTime"><%= date.toLocaleString('sk-SK', { hour: 'numeric', minute: 'numeric', second: 'numeric' }) %></span></p>
  50. <p><%~ dateIcon %> <span id="topbarDate"><%= date.toLocaleDateString('sk-SK', { weekday: "long", year: "numeric", month: "long", day: "numeric" }) %></span></p>
  51. <div class="end">
  52. <a role="button" href="/en"><%~ usFlag %></a>
  53. <a role="button" href="/"><%~ homeIcon %></a>
  54. <a role="button" href="/settings"><%~ settingsIcon %></a>
  55. </div>
  56. <script defer>
  57. setInterval(() => {
  58. const topbarTime = document.querySelector("#topbarTime")
  59. const topbarDate = document.querySelector("#topbarDate")
  60. const date = new Date()
  61. const timeString = date.toLocaleString('sk-SK', { hour: 'numeric', minute: 'numeric', second: 'numeric' })
  62. const dateString = date.toLocaleDateString('sk-SK', { weekday: "long", year: "numeric", month: "long", day: "numeric" })
  63. topbarTime.textContent = timeString
  64. if (topbarDate.textContent !== dateString) {
  65. topbarDate.textContent = dateString
  66. }
  67. }, 1000)
  68. </script>
  69. </header>