aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/user_mention_pill.php
diff options
context:
space:
mode:
Diffstat (limited to 'templates/user_mention_pill.php')
-rw-r--r--templates/user_mention_pill.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/templates/user_mention_pill.php b/templates/user_mention_pill.php
new file mode 100644
index 0000000..3b9a018
--- /dev/null
+++ b/templates/user_mention_pill.php
@@ -0,0 +1,31 @@
+<?php
+$type ??= 'add';
+?>
+
+<?php if ($type == 'add'): ?>
+
+ <button class="inlinePill" type="button" hx-get="/fragment/note/mentionPill" hx-disabled-elt="this" hx-swap="outerHTML">
+ <span class="pillIcon material-symbols add"></span>
+ <span class="pillText"><?= __('writeNote.mentions.add.action') ?></span>
+ </button>
+
+<?php elseif ($type == 'edit'): ?>
+
+ <form class="inlinePill nopanel <?= ($invalid ?? false) ? 'invalid' : '' ?>" hx-get="/fragment/note/mentionPill"
+ hx-disabled-elt="this" hx-swap="outerHTML">
+ <span class="pillIcon material-symbols alternate-email"></span>
+ <input type="text" name="handle" class="pillInput" value="<?= $value ?? '' ?>"
+ placeholder="<?= __('writeNote.mentions.placeholder') ?>" required autofocus>
+ <button type="submit" class="material-symbols add"></button>
+ </form>
+
+<?php elseif ($type == 'user'): ?>
+
+ <button class="inlinePill" type="button" _="on click remove me">
+ <img class="pillIcon" src="<?= $actor->avatar ?? '/static/default-avatar.png' ?>">
+ <span class="pillText"><?= $actor->displayName ?></span>
+ <input type="hidden" name="mentions[]" value="<?= $actor->id ?>">
+ <span class="pillIcon material-symbols close-small"></span>
+ </button>
+
+<?php endif; ?> \ No newline at end of file