Skip to content

Email for professionals and teams

improve calendar mobile layout

Hieu Nguyen (Jack)06cbb6342019
diff --git a/src/app/(calendar)/calendar-mobile-upcoming.tsx b/src/app/(calendar)/calendar-mobile-upcoming.tsx
index 619d094..e234929 100644
--- a/src/app/(calendar)/calendar-mobile-upcoming.tsx
+++ b/src/app/(calendar)/calendar-mobile-upcoming.tsx
@@ -1,6 +1,7 @@
"use client";
import { useRouter } from "next/navigation";
+import { SidebarHeader } from "@/components/sidebar-header";
import { useSidebar } from "@/components/sidebar-state";
import { UpcomingSidebar } from "./upcoming-sidebar";
@@ -12,9 +13,14 @@ export function CalendarMobileUpcoming() {
const router = useRouter();
if (!mobile) return null;
return (
- <UpcomingSidebar drawer refreshKey={mobileOpen} onSelect={(event) => {
- toggle();
- router.push(`/calendar?event=${encodeURIComponent(event.id)}`);
- }} />
+ <div className="flex h-full min-h-0 flex-col">
+ <div className="shrink-0 px-3 pt-4"><SidebarHeader href="/inbox" /></div>
+ <div className="min-h-0 flex-1">
+ <UpcomingSidebar drawer refreshKey={mobileOpen} onSelect={(event) => {
+ toggle();
+ router.push(`/calendar?event=${encodeURIComponent(event.id)}`);
+ }} />
+ </div>
+ </div>
);
}
diff --git a/src/app/(calendar)/layout.tsx b/src/app/(calendar)/layout.tsx
index cafd2b1..e4fa3cf 100644
--- a/src/app/(calendar)/layout.tsx
+++ b/src/app/(calendar)/layout.tsx
@@ -13,7 +13,7 @@ import { LicenseIndicator } from "@/components/license-indicator";
import { MailSearchProvider } from "@/components/mail-search/mail-search-context";
import { MailboxProvider } from "@/components/mailbox-provider";
import { MailboxSelector } from "@/components/mailbox-selector";
-import { SidebarAside, MobileMenuButton, MobileBrandIcon } from "@/components/sidebar-aside";
+import { SidebarAside, MobileMenuButton } from "@/components/sidebar-aside";
import { SidebarHeader } from "@/components/sidebar-header";
import { SidebarProvider } from "@/components/sidebar-state";
import { ShortcutsProvider } from "@/components/shortcuts";
@@ -47,12 +47,10 @@ export default function CalendarLayout({ children }: { children: React.ReactNode
<div className="grid h-dvh grid-cols-[minmax(0,1fr)] overflow-hidden bg-[#f6f8fc]">
<SidebarAside className="md:hidden"><CalendarMobileUpcoming /></SidebarAside>
<div className="flex min-h-0 min-w-0 flex-col">
- <header className="flex h-16 w-full shrink-0 items-center gap-3 pr-4 text-sm max-md:h-auto max-md:flex-wrap max-md:gap-y-2 max-md:pb-2">
- <MobileMenuButton className="ml-2" />
- <MobileBrandIcon />
+ <header className="flex h-16 w-full shrink-0 items-center gap-3 pr-4 text-sm max-md:h-auto max-md:flex-wrap max-md:gap-x-2 max-md:gap-y-2 max-md:pb-2 max-md:pr-2 max-md:pt-1">
+ <MobileMenuButton className="ml-1" />
<div className="hidden shrink-0 px-3 md:block [&>div]:mb-0" style={{ width: "calc(var(--sidebar-width) + 1.5rem)" }}><SidebarHeader href="/inbox" /></div>
- <div className="relative shrink-0 md:hidden"><select aria-label="Calendar section" value={pathname === "/booking" ? "/booking" : "/calendar"} onChange={(event) => router.push(event.target.value)} className="h-10 appearance-none rounded-full border-0 bg-white pl-4 pr-10 text-sm font-medium text-neutral-700"><option value="/booking">Bookings</option><option value="/calendar">Calendar</option></select><ChevronDown className="pointer-events-none absolute right-3 top-1/2 h-5 w-5 -translate-y-1/2 text-neutral-600" /></div>
- <span className="flex-1 md:hidden" />
+ <div className="min-w-0 flex-1 basis-0 md:hidden"><div className="relative w-fit max-w-full"><select aria-label="Calendar section" value={pathname === "/booking" ? "/booking" : "/calendar"} onChange={(event) => router.push(event.target.value)} className="h-8 max-w-full appearance-none rounded-full border-0 bg-white pl-3 pr-8 text-sm font-medium text-neutral-700"><option value="/booking">Bookings</option><option value="/calendar">Calendar</option></select><ChevronDown className="pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral-600" /></div></div>
<div className="flex min-w-0 flex-1 items-center gap-3 md:overflow-x-auto max-md:contents">
<nav aria-label="Calendar sections" className="flex shrink-0 max-md:hidden items-center rounded-full bg-white p-1">
<Link href="/booking" aria-current={pathname === "/booking" ? "page" : undefined} className={clsx("rounded-full px-4 py-2 text-sm font-medium transition-colors", pathname === "/booking" ? "bg-blue-600 text-white" : "text-neutral-600 hover:bg-neutral-100")}>Bookings</Link>
diff --git a/src/app/(dashboard)/layout.tsx b/src/app/(dashboard)/layout.tsx
index 48360a8..242d236 100644
--- a/src/app/(dashboard)/layout.tsx
+++ b/src/app/(dashboard)/layout.tsx
@@ -15,7 +15,7 @@ import { Button } from "@/components/ui/button";
import { LicenseIndicator } from "@/components/license-indicator";
import { DashboardNav } from "@/components/dashboard-nav";
import { SidebarProvider } from "@/components/sidebar-state";
-import { SidebarAside, MobileMenuButton, MobileBrandIcon } from "@/components/sidebar-aside";
+import { SidebarAside, MobileMenuButton } from "@/components/sidebar-aside";
import { SidebarResizeBoundary } from "@/components/sidebar-resize-boundary";
import { ShortcutsProvider } from "@/components/shortcuts";
import clsx from "clsx";
@@ -55,7 +55,6 @@ export default function DashboardLayout({
<div className="flex min-h-0 min-w-0 flex-col">
<header className="flex h-16 w-full shrink-0 items-center gap-3 pr-4 text-sm">
<MobileMenuButton className="ml-2" />
- <MobileBrandIcon />
<MailSearchInput />
{/* <Link
href="/settings/account"
diff --git a/src/app/(settings)/layout.tsx b/src/app/(settings)/layout.tsx
index 75b1d36..7dc6fe6 100644
--- a/src/app/(settings)/layout.tsx
+++ b/src/app/(settings)/layout.tsx
@@ -13,7 +13,7 @@ import { LicenseIndicator } from "@/components/license-indicator";
import { DashboardNav } from "@/components/dashboard-nav";
import { SidebarProvider } from "@/components/sidebar-state";
import { ShortcutsProvider } from "@/components/shortcuts";
-import { SidebarAside, MobileMenuButton, MobileBrandIcon } from "@/components/sidebar-aside";
+import { SidebarAside, MobileMenuButton } from "@/components/sidebar-aside";
export default function DashboardLayout({
children,
@@ -34,7 +34,6 @@ export default function DashboardLayout({
<div className="flex min-h-0 min-w-0 flex-col">
<header className="flex h-16 w-full shrink-0 items-center gap-4 pr-4 text-sm">
<MobileMenuButton className="ml-2" />
- <MobileBrandIcon />
<MailSearchInput />
{/* <Link
href="/settings/account"
diff --git a/src/components/sidebar-aside.tsx b/src/components/sidebar-aside.tsx
index b8451ba..3083f28 100644
--- a/src/components/sidebar-aside.tsx
+++ b/src/components/sidebar-aside.tsx
@@ -3,7 +3,6 @@
import clsx from "clsx";
import { Menu } from "lucide-react";
import type { ReactNode } from "react";
-import { useBranding } from "./branding-provider";
import { useSidebar } from "./sidebar-state";
export function SidebarAside({ children, className }: { children: ReactNode; className?: string }) {
@@ -43,18 +42,11 @@ export function MobileMenuButton({ className }: { className?: string }) {
);
}
-export function MobileBrandIcon() {
- const branding = useBranding();
- return <img src={branding.iconUrl} height={24} width={24} alt="" className="shrink-0 md:hidden" />;
-}
-
-// Phone top bar for pages without a header of their own: menu button, brand icon, then the page title.
+// Phone top bar for pages without a header of their own: menu button, then the page title.
export function MobileTopBar({ title }: { title?: string }) {
- const branding = useBranding();
return (
<div className="flex h-16 shrink-0 items-center gap-2 pl-2 md:hidden">
<MobileMenuButton />
- <MobileBrandIcon />
{title && <h2 className="min-w-0 max-w-[40vw] truncate text-base font-medium text-neutral-900">{title}</h2>}
</div>
);