Skip to content

Commit 3390812

Browse files
Responsive improvements (dubinc#3670)
Co-authored-by: Steven Tey <stevensteel97@gmail.com>
1 parent f08b872 commit 3390812

9 files changed

Lines changed: 34 additions & 34 deletions

File tree

apps/web/app/(ee)/app.dub.co/(new-program)/header.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import { useSidebar } from "./sidebar-context";
1515

1616
export function ProgramOnboardingHeader() {
1717
const pathname = usePathname();
18-
const { isMobile } = useMediaQuery();
18+
const { isDesktop } = useMediaQuery();
1919
const { getValues } = useFormContext();
2020
const { isOpen, setIsOpen } = useSidebar();
2121
const { id: workspaceId, slug: workspaceSlug } = useWorkspace();
2222

2323
useEffect(() => {
24-
document.body.style.overflow = isOpen && isMobile ? "hidden" : "auto";
25-
}, [isOpen, isMobile]);
24+
document.body.style.overflow = isOpen && !isDesktop ? "hidden" : "auto";
25+
}, [isOpen, isDesktop]);
2626

2727
const { executeAsync, isPending } = useAction(onboardProgramAction, {
2828
onError: ({ error }) => {
@@ -62,14 +62,14 @@ export function ProgramOnboardingHeader() {
6262
<div className="flex items-center gap-5">
6363
<button
6464
onClick={() => setIsOpen(true)}
65-
className="rounded-md p-1 hover:bg-neutral-100 md:hidden"
65+
className="rounded-md p-1 hover:bg-neutral-100 lg:hidden"
6666
>
6767
<Menu className="h-5 w-5 text-neutral-600" />
6868
</button>
6969
<Link href={`/${workspaceSlug}`} className="flex items-center">
7070
<Wordmark className="h-7" />
7171
</Link>
72-
<h1 className="hidden text-base font-semibold text-neutral-700 md:block">
72+
<h1 className="hidden text-base font-semibold text-neutral-700 lg:block">
7373
Create partner program
7474
</h1>
7575
</div>

apps/web/app/(ee)/app.dub.co/(new-program)/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export default function Layout({ children }: { children: React.ReactNode }) {
1111
<div className="min-h-screen bg-white">
1212
<ProgramOnboardingFormWrapper>
1313
<ProgramOnboardingHeader />
14-
<div className="md:grid md:grid-cols-[240px_minmax(0,1fr)]">
14+
<div className="lg:grid lg:grid-cols-[240px_minmax(0,1fr)]">
1515
<ProgramOnboardingSteps />
16-
<main className="px-4 py-6 md:px-8">{children}</main>
16+
<main className="px-4 py-6 lg:px-8">{children}</main>
1717
</div>
1818
</ProgramOnboardingFormWrapper>
1919
</div>

apps/web/app/(ee)/app.dub.co/(new-program)/steps.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import { useSidebar } from "./sidebar-context";
1313

1414
export function ProgramOnboardingSteps() {
1515
const pathname = usePathname();
16-
const { isMobile } = useMediaQuery();
16+
const { isDesktop } = useMediaQuery();
1717
const { isOpen, setIsOpen } = useSidebar();
1818
const { slug } = useParams<{ slug: string }>();
1919
const [programOnboarding] =
2020
useWorkspaceStore<ProgramData>("programOnboarding");
2121

2222
useEffect(() => {
23-
document.body.style.overflow = isOpen && isMobile ? "hidden" : "auto";
24-
}, [isOpen, isMobile]);
23+
document.body.style.overflow = isOpen && !isDesktop ? "hidden" : "auto";
24+
}, [isOpen, isDesktop]);
2525

2626
const currentPath = pathname.replace(`/${slug}`, "");
2727

@@ -40,10 +40,10 @@ export function ProgramOnboardingSteps() {
4040
<>
4141
<div
4242
className={cn(
43-
"fixed left-0 top-14 z-20 h-[calc(100vh-3.5rem)] w-screen transition-[background-color,backdrop-filter] md:sticky md:top-0 md:z-0 md:h-[calc(100vh-3.5rem)] md:w-full md:bg-transparent",
43+
"fixed left-0 top-14 z-20 h-[calc(100vh-3.5rem)] w-screen transition-[background-color,backdrop-filter] lg:sticky lg:top-0 lg:z-0 lg:h-[calc(100vh-3.5rem)] lg:w-full lg:bg-transparent",
4444
isOpen
4545
? "bg-black/20 backdrop-blur-sm"
46-
: "bg-transparent max-md:pointer-events-none",
46+
: "bg-transparent max-lg:pointer-events-none",
4747
)}
4848
onClick={(e) => {
4949
if (e.target === e.currentTarget) {
@@ -54,12 +54,12 @@ export function ProgramOnboardingSteps() {
5454
>
5555
<div
5656
className={cn(
57-
"relative h-full w-[240px] max-w-full bg-white transition-transform md:translate-x-0",
57+
"relative h-full w-[240px] max-w-full bg-white transition-transform lg:translate-x-0",
5858
!isOpen && "-translate-x-full",
5959
)}
6060
>
6161
<div className="p-4">
62-
<div className="mb-4 flex items-center justify-between md:hidden">
62+
<div className="mb-4 flex items-center justify-between lg:hidden">
6363
<h2 className="text-sm font-medium">Program Setup</h2>
6464
<button
6565
onClick={() => setIsOpen(false)}

apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/page-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ function BrandedChart({
642642
function ViewMoreButton({ href }: { href: string }) {
643643
return (
644644
<div className="-mr-2 overflow-hidden pr-2 [mask-image:linear-gradient(270deg,transparent,black_8px)] [mask-origin:padding-box]">
645-
<div className="overflow-visible transition-all duration-200 focus-within:w-[82px] focus-within:opacity-100 group-hover:w-[82px] group-hover:opacity-100 sm:w-0 sm:opacity-0">
645+
<div className="overflow-visible transition-all duration-200 focus-within:w-[82px] focus-within:opacity-100 group-hover:w-[82px] group-hover:opacity-100 lg:w-0 lg:opacity-0">
646646
<Link
647647
href={href}
648648
className={cn(

apps/web/ui/layout/main-nav.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,29 @@ export function MainNav({
4040
}>) {
4141
const pathname = usePathname();
4242

43-
const { isMobile } = useMediaQuery();
43+
const { isDesktop } = useMediaQuery();
4444
const [isOpen, setIsOpen] = useState(false);
4545
const isUpgradeBannerVisible = useUpgradeBannerVisible();
4646

4747
// Prevent body scroll when side nav is open
4848
useEffect(() => {
49-
document.body.style.overflow = isOpen && isMobile ? "hidden" : "auto";
50-
}, [isOpen, isMobile]);
49+
document.body.style.overflow = isOpen && !isDesktop ? "hidden" : "auto";
50+
}, [isOpen, isDesktop]);
5151

5252
// Close side nav when pathname changes
5353
useEffect(() => {
5454
setIsOpen(false);
5555
}, [pathname]);
5656

5757
return (
58-
<div className="min-h-screen md:grid md:grid-cols-[min-content_minmax(0,1fr)]">
58+
<div className="min-h-screen lg:grid lg:grid-cols-[min-content_minmax(0,1fr)]">
5959
{/* Side nav backdrop */}
6060
<div
6161
className={cn(
62-
"fixed left-0 z-50 w-screen transition-[background-color,backdrop-filter] md:sticky md:z-auto md:w-full md:bg-transparent",
62+
"fixed left-0 z-50 w-screen transition-[background-color,backdrop-filter] lg:sticky lg:z-auto lg:w-full lg:bg-transparent",
6363
isOpen
6464
? "bg-black/20 backdrop-blur-sm"
65-
: "bg-transparent max-md:pointer-events-none",
65+
: "bg-transparent max-lg:pointer-events-none",
6666
isUpgradeBannerVisible
6767
? "top-12 h-[calc(100dvh-48px)]"
6868
: "top-0 h-dvh",
@@ -77,7 +77,7 @@ export function MainNav({
7777
{/* Side nav */}
7878
<div
7979
className={cn(
80-
"relative h-full w-min max-w-full bg-neutral-200 transition-transform md:translate-x-0",
80+
"relative h-full w-min max-w-full bg-neutral-200 transition-transform lg:translate-x-0",
8181
!isOpen && "-translate-x-full",
8282
)}
8383
>
@@ -86,11 +86,11 @@ export function MainNav({
8686
</div>
8787
<div
8888
className={cn(
89-
"bg-neutral-200 pb-[var(--page-bottom-margin)] pt-[var(--page-top-margin)] [--page-bottom-margin:0px] [--page-top-margin:0px] md:pb-2 md:pr-2 md:[--page-bottom-margin:0.5rem] md:[--page-top-margin:0.5rem]",
89+
"bg-neutral-200 pb-[var(--page-bottom-margin)] pt-[var(--page-top-margin)] [--page-bottom-margin:0px] [--page-top-margin:0px] lg:pb-2 lg:pr-2 lg:[--page-bottom-margin:0.5rem] lg:[--page-top-margin:0.5rem]",
9090
isUpgradeBannerVisible ? "mt-12 h-[calc(100vh-48px)]" : "h-screen",
9191
)}
9292
>
93-
<div className="relative h-full overflow-y-auto bg-neutral-100 pt-px md:rounded-xl md:bg-white">
93+
<div className="relative h-full overflow-y-auto bg-neutral-100 pt-px lg:rounded-xl lg:bg-white">
9494
<SideNavContext.Provider value={{ isOpen, setIsOpen }}>
9595
{children}
9696
</SideNavContext.Provider>

apps/web/ui/layout/page-content/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function PageContent({
2121
return (
2222
<div
2323
className={cn(
24-
"flex min-h-full flex-col rounded-t-[inherit] bg-neutral-100 md:bg-white",
24+
"flex min-h-full flex-col rounded-t-[inherit] bg-neutral-100 lg:bg-white",
2525
className,
2626
)}
2727
>

apps/web/ui/layout/page-content/nav-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function NavButton() {
1313
variant="outline"
1414
onClick={() => setIsOpen((o) => !o)}
1515
icon={<LayoutSidebar className="size-4" />}
16-
className="h-auto w-fit p-1 md:hidden"
16+
className="h-auto w-fit p-1 lg:hidden"
1717
/>
1818
);
1919
}

apps/web/ui/layout/page-content/page-content-old.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export function PageContentOld({
3434
return (
3535
<div
3636
className={cn(
37-
"mt-3 bg-neutral-100 md:bg-white",
38-
(hasTitle || hasDescription) && "md:mt-6 md:py-3",
37+
"mt-3 bg-neutral-100 lg:bg-white",
38+
(hasTitle || hasDescription) && "lg:mt-6 lg:py-3",
3939
className,
4040
)}
4141
>
@@ -61,18 +61,18 @@ export function PageContentOld({
6161
</div>
6262
)}
6363
{hasDescription && (
64-
<p className="mt-1 hidden text-base text-neutral-500 md:block">
64+
<p className="mt-1 hidden text-base text-neutral-500 lg:block">
6565
{description}
6666
</p>
6767
)}
6868
</div>
6969
)}
7070
</div>
7171
{titleControls && (
72-
<div className="hidden md:block">{titleControls}</div>
72+
<div className="hidden lg:block">{titleControls}</div>
7373
)}
7474
{showControls && (
75-
<div className="flex items-center gap-4 md:hidden">
75+
<div className="flex items-center gap-4 lg:hidden">
7676
<HelpButton />
7777
<UserDropdown />
7878
</div>
@@ -81,13 +81,13 @@ export function PageContentOld({
8181
</MaxWidthWrapper>
8282
<div
8383
className={cn(
84-
"bg-white pt-2.5 max-md:mt-3 max-md:rounded-t-[16px]",
84+
"bg-white pt-2.5 max-lg:mt-3 max-lg:rounded-t-[16px]",
8585
contentWrapperClassName,
8686
)}
8787
>
8888
{hasDescription && (
8989
<MaxWidthWrapper>
90-
<p className="mb-3 mt-1 text-base text-neutral-500 md:hidden">
90+
<p className="mb-3 mt-1 text-base text-neutral-500 lg:hidden">
9191
{description}
9292
</p>
9393
</MaxWidthWrapper>

apps/web/ui/layout/page-content/page-content-with-side-panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function PageContentWithSidePanel({
5555
>
5656
<div
5757
className={cn(
58-
"@container/page-content relative grid min-h-[var(--page-height)] grid-cols-[minmax(340px,1fr)_minmax(0,min-content)] rounded-t-[inherit] bg-neutral-100 [--page-height:calc(100dvh-var(--page-top-margin)-var(--page-bottom-margin)-1px)] md:bg-white",
58+
"@container/page-content relative grid min-h-[var(--page-height)] grid-cols-[minmax(340px,1fr)_minmax(0,min-content)] rounded-t-[inherit] bg-neutral-100 [--page-height:calc(100dvh-var(--page-top-margin)-var(--page-bottom-margin)-1px)] lg:bg-white",
5959
individualScrolling && "h-[var(--page-height)]",
6060
className,
6161
)}

0 commit comments

Comments
 (0)