Skip to content

Commit 5adce18

Browse files
committed
fix: drawer should only be render on mobile
1 parent deb7a14 commit 5adce18

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

platforms/metagram/src/lib/fragments/Comment/Comment.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@
6969
/>
7070
</button>
7171
<span class="bg-black-600 inline-block h-1 w-1 rounded-full"></span>
72-
<button onclick={handleReply} class="text-black-600 font-semibold"
73-
>Reply</button
74-
>
72+
<button onclick={handleReply} class="text-black-600 font-semibold">Reply</button>
7573
<span class="bg-black-600 inline-block h-1 w-1 rounded-full"></span>
7674
<p class="text-black-600">{comment.time}</p>
7775
</div>

platforms/metagram/src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ export type PostData = {
2929
likes: number;
3030
comments: number;
3131
};
32-
};
32+
};

platforms/metagram/src/routes/(protected)/home/+page.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { Comment, MessageInput } from '$lib/fragments';
77
import type { CommentType, PostData } from '$lib/types';
88
9-
109
let listElement: HTMLElement;
1110
let visiblePosts: PostData[] = $state([]);
1211
let maxVisiblePosts = $state(20);
@@ -96,7 +95,13 @@
9695
count={post.count}
9796
callback={{
9897
like: () => alert('like'),
99-
comment: () => drawer?.present({ animate: true }),
98+
comment: () => {
99+
if (window.matchMedia('(max-width: 768px)').matches) {
100+
drawer?.present({ animate: true });
101+
} else {
102+
// comments to be shown in right aside
103+
}
104+
},
100105
menu: () => alert('menu')
101106
}}
102107
/>

0 commit comments

Comments
 (0)