Skip to content

Commit f3d279a

Browse files
authored
feat: Add MobileBanner component to enhance user experience on mobile devices (huggingface#352)
* feat: Add MobileBanner component to enhance user experience on mobile devices * feat: Update MobileBanner component text and styling for improved clarity
1 parent 29cea7b commit f3d279a

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik';
2+
import { LuX } from '@qwikest/icons/lucide';
3+
import { Button } from '~/components/ui/button/button';
4+
5+
export const MobileBanner = component$(() => {
6+
const isVisible = useSignal(false);
7+
8+
useVisibleTask$(() => {
9+
isVisible.value = localStorage.getItem('mobile_banner') !== 'false';
10+
});
11+
12+
if (!isVisible.value) {
13+
return null;
14+
}
15+
16+
return (
17+
<div class="fixed top-0 left-0 right-0 z-[53] visible md:invisible">
18+
<div
19+
class="bg-blue-100 border-t border-b border-blue-500 text-blue-700 px-4 py-1"
20+
role="alert"
21+
>
22+
<div class="flex items-center justify-between gap-2">
23+
<p class="font-bold">Sheets is optimized for desktop use</p>
24+
<Button
25+
look="ghost"
26+
class="text-blue-500 hover:text-blue-700"
27+
onClick$={() => {
28+
isVisible.value = false;
29+
localStorage.setItem('mobile_banner', 'false');
30+
}}
31+
>
32+
<LuX class="text-lg" />
33+
</Button>
34+
</div>
35+
<p class="text-sm">
36+
Please use a larger-screen device for the best experience, including
37+
full table interaction and access to all features.
38+
</p>
39+
</div>
40+
</div>
41+
);
42+
});

src/routes/home/dataset/[id]/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { component$ } from '@builder.io/qwik';
22
import type { DocumentHead } from '@builder.io/qwik-city';
33
import { Login } from '~/components/ui/login/Login';
4+
import { MobileBanner } from '~/components/ui/mobile/banner';
45
import { Tips } from '~/components/ui/tips/tips';
56
import { DatasetName } from '~/features/datasets';
67
import { SaveDataset } from '~/features/export';
@@ -16,6 +17,7 @@ export default component$(() => {
1617

1718
return (
1819
<ActiveDatasetProvider>
20+
<MobileBanner />
1921
<div class="flex flex-col h-full w-full">
2022
<div class="sticky">
2123
<div class="flex flex-col gap-2">

0 commit comments

Comments
 (0)