|
1 | 1 | <script lang="ts"> |
2 | | - import { Badge, Layout, Typography } from '@appwrite.io/pink-svelte'; |
| 2 | + import { Badge, FloatingActionBar, Layout, Typography } from '@appwrite.io/pink-svelte'; |
3 | 3 | import { isSmallViewport } from '$lib/stores/viewport'; |
4 | 4 |
|
5 | 5 | let { |
6 | | - show = true |
| 6 | + show = true, |
| 7 | + onMobileClick |
7 | 8 | }: { |
8 | 9 | show?: boolean; |
| 10 | + onMobileClick: () => Promise<void> | void; |
9 | 11 | } = $props(); |
10 | 12 | </script> |
11 | 13 |
|
12 | | -{#if show && !$isSmallViewport} |
13 | | - <div class="suggestions-wrapper"> |
14 | | - <div class="popover-content"> |
15 | | - <Layout.Stack inline gap="xs" direction="row" alignItems="center"> |
16 | | - <Typography.Caption variant="400" color="--fgcolor-neutral-secondary"> |
17 | | - Press |
18 | | - </Typography.Caption> |
| 14 | +{#if show} |
| 15 | + {#if $isSmallViewport} |
| 16 | + <button type="button" class="floating-action-bar" onclick={onMobileClick}> |
| 17 | + <FloatingActionBar> |
| 18 | + <svelte:fragment slot="start"> |
| 19 | + <Typography.Text variant="m-500">Tap to apply suggestions</Typography.Text> |
| 20 | + </svelte:fragment> |
| 21 | + </FloatingActionBar> |
| 22 | + </button> |
| 23 | + {:else} |
| 24 | + <div class="suggestions-wrapper"> |
| 25 | + <div class="popover-content"> |
| 26 | + <Layout.Stack inline gap="xs" direction="row" alignContent="center"> |
| 27 | + <Typography.Caption variant="400" color="--fgcolor-neutral-secondary"> |
| 28 | + Press |
| 29 | + </Typography.Caption> |
19 | 30 |
|
20 | | - <Layout.Stack direction="row" inline gap="xxxs" style="height: fit-content"> |
21 | | - <Badge content="⌘" variant="secondary" size="xs" /> |
| 31 | + <Layout.Stack direction="row" inline gap="xxxs" style="height: fit-content"> |
| 32 | + <Badge content="⌘" variant="secondary" size="xs" /> |
| 33 | + <Badge content="A" variant="secondary" size="xs" /> |
| 34 | + </Layout.Stack> |
22 | 35 |
|
23 | | - <Badge content="A" variant="secondary" size="xs" /> |
| 36 | + <Typography.Caption variant="400" color="--fgcolor-neutral-secondary"> |
| 37 | + for suggestions |
| 38 | + </Typography.Caption> |
24 | 39 | </Layout.Stack> |
25 | | - |
26 | | - <Typography.Caption variant="400" color="--fgcolor-neutral-secondary"> |
27 | | - for suggestions |
28 | | - </Typography.Caption> |
29 | | - </Layout.Stack> |
| 40 | + </div> |
30 | 41 | </div> |
31 | | - </div> |
| 42 | + {/if} |
32 | 43 | {/if} |
33 | 44 |
|
34 | 45 | <style lang="scss"> |
|
38 | 49 | position: absolute; |
39 | 50 | pointer-events: none; |
40 | 51 | transform: translateX(40%); |
41 | | -
|
42 | | - @media (max-width: 768px) { |
43 | | - top: auto; |
44 | | - bottom: var(--space-12); |
45 | | - } |
46 | 52 | } |
47 | 53 |
|
48 | 54 | .popover-content { |
|
60 | 66 | 0 1px 3px 0 rgba(0, 0, 0, 0.03), |
61 | 67 | 0 4px 4px 0 rgba(0, 0, 0, 0.04); |
62 | 68 | } |
| 69 | +
|
| 70 | + .floating-action-bar { |
| 71 | + left: 50%; |
| 72 | + bottom: 5%; |
| 73 | + width: 100%; |
| 74 | + max-width: 320px; |
| 75 | + position: fixed; |
| 76 | + transform: translateX(-50%); |
| 77 | +
|
| 78 | + & > :global:first-child { |
| 79 | + display: unset; /* stack with flex-start in FAB */ |
| 80 | +
|
| 81 | + & > :global:first-child { |
| 82 | + width: 100%; |
| 83 | + justify-content: center; |
| 84 | + } |
| 85 | + } |
| 86 | + } |
63 | 87 | </style> |
0 commit comments