aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/interaction_button.php
diff options
context:
space:
mode:
Diffstat (limited to 'templates/interaction_button.php')
-rw-r--r--templates/interaction_button.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/templates/interaction_button.php b/templates/interaction_button.php
new file mode 100644
index 0000000..a1fb3b0
--- /dev/null
+++ b/templates/interaction_button.php
@@ -0,0 +1,15 @@
+<?php
+$active = $active ?? false;
+$tooltip = match ($action) {
+ 'like' => 'Like',
+ 'dislike' => 'Dislike',
+ 'reshare' => 'Reshare'
+};
+$icon = match ($action) {
+ 'like' => 'favorite',
+ 'dislike' => 'heart_broken',
+ 'reshare' => $active ? 'repeat_on' : 'repeat'
+};
+?>
+<button title="<?= $tooltip ?>" class="icon material-symbols-outlined <?= $action . ($active ? ' active' : '') ?>"
+ hx-post="<?= "/fragment/note/$note->id/$action" ?>" hx-swap="outerHTML"><?= $icon ?></button> \ No newline at end of file