aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/user_mention_pill.php
blob: 3b9a0180fac4448471e79bc74d7cbf785b9ff020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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; ?>