fix: add button that goes back to town from any page
authorxangelo <me@xangelo.ca>
Thu, 31 Aug 2023 21:08:26 +0000 (17:08 -0400)
committerxangelo <me@xangelo.ca>
Thu, 31 Aug 2023 21:08:26 +0000 (17:08 -0400)
src/server/views/components/button.ts

index a6daca0784cf6a282817b102c85ff3f3a10ff332..11a9948ca9875fc2e938ca55b0ddfc5cd61b2a10 100644 (file)
@@ -33,3 +33,11 @@ export function Button(attrs: CoreAttributes & Record<string, any>, value: strin
 
   return `<button ${attributes.join(" ")}>${value}</button>`;
 }
+
+export function BackToTown(): string {
+  return Button({
+    'id': 'back-to-town',
+    'hx-get': '/player/explore',
+    'hx-target': '#explore'
+  }, 'Back to Town');
+}