-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapScreenLayout.tsx
More file actions
69 lines (60 loc) · 1.75 KB
/
Copy pathMapScreenLayout.tsx
File metadata and controls
69 lines (60 loc) · 1.75 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import type { CSSProperties, ReactNode } from 'react';
import { useIsDesktop } from '@/hooks/useIsDesktop';
export interface MapScreenLayoutProps {
className?: string;
style?: CSSProperties;
sidebar?: ReactNode;
topLeft?: ReactNode;
topRight?: ReactNode;
bottomLeft?: ReactNode;
bottomRight?: ReactNode;
children?: ReactNode;
}
export function MapScreenLayout({
className,
style,
sidebar,
topLeft,
topRight,
bottomLeft,
bottomRight,
children,
}: MapScreenLayoutProps) {
const isDesktop = useIsDesktop();
return (
<div
className={`flex h-full min-h-0 flex-col gap-3 overflow-hidden lg:flex-row ${className ?? ''}`}
style={style}
>
<div className="relative flex-1 min-h-0 overflow-hidden rounded-card bg-surface-card shadow-card">
{children}
{topLeft && (
<div className="absolute top-4 left-3 z-10 flex gap-2 items-center">
{topLeft}
</div>
)}
{topRight && (
<div className="absolute top-4 right-3 z-10 flex gap-2 items-center">
{topRight}
</div>
)}
{bottomLeft && (
<div className="absolute bottom-4 left-4 z-10 flex gap-2 items-center">
{bottomLeft}
</div>
)}
{bottomRight && (
<div className="absolute bottom-4 right-4 z-10 flex gap-2 items-center">
{bottomRight}
</div>
)}
</div>
{/* eslint-disable-next-line eqeqeq -- intentional null/undefined check */}
{isDesktop && sidebar != null && (
<aside className="flex w-full max-w-[380px] shrink-0 flex-col overflow-y-auto rounded-card bg-surface-card px-4 pb-4 pt-6 shadow-card">
{sidebar}
</aside>
)}
</div>
);
}