Skip to content

Commit a70051f

Browse files
committed
Tweak LearnNavLinkCard for mobiles with container queries
1 parent d120383 commit a70051f

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/components/nav-links/learn-nav-link-card.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ interface LearnNavLinkCardProps {
1414
currentIndex: number
1515
flatDocsDirectories: Item[]
1616
className?: string
17+
articleNoun: string
1718
}
1819

1920
export function LearnNavLinkCard({
2021
flatDocsDirectories,
2122
currentIndex,
2223
className,
24+
articleNoun,
2325
}: LearnNavLinkCardProps): ReactElement | null {
2426
const themeConfig = useThemeConfig()
2527
const nav = themeConfig.navigation
@@ -46,7 +48,7 @@ export function LearnNavLinkCard({
4648
<NextLink
4749
href={displayPost.route}
4850
className={clsx(
49-
"gql-focus-visible relative mx-auto flex max-w-[1056px] items-center gap-8 border border-neu-200 bg-neu-0 p-8 hover:ring hover:ring-neu-100 dark:border-neu-50 dark:hover:ring-neu-50/50",
51+
"gql-focus-visible relative mx-auto flex max-w-[1056px] items-center gap-8 border border-neu-200 bg-neu-0 p-8 @container hover:ring hover:ring-neu-100 dark:border-neu-50 dark:hover:ring-neu-50/50",
5052
className,
5153
)}
5254
>
@@ -75,29 +77,29 @@ export function LearnNavLinkCard({
7577
/>
7678
</div>
7779

78-
<div className="flex flex-1 flex-col gap-4">
79-
<p className="typography-menu text-pri-base dark:text-pri-light">
80-
{isNext ? "next lesson" : "previous lesson"}
80+
<div className="flex flex-1 flex-col gap-3 sm:gap-4">
81+
<p className="typography-menu text-xs text-pri-base @[740px]:text-sm dark:text-pri-light">
82+
{isNext ? `next ${articleNoun}` : `previous ${articleNoun}`}
8183
</p>
8284

83-
<div className="flex flex-col gap-4 text-neu-900">
84-
<h2 className="typography-h2">{displayPost.title}</h2>
85-
{pageData?.description && (
86-
<p className="typography-body-md max-w-[560px]">
87-
{pageData.description}
88-
</p>
89-
)}
90-
</div>
85+
<h2 className="typography-h2 md:typography-h3 md:@[700px]:typography-h2">
86+
{displayPost.title}
87+
</h2>
88+
{pageData?.description && (
89+
<p className="typography-body-md max-w-[560px]">
90+
{pageData.description}
91+
</p>
92+
)}
9193

9294
<div className="flex h-12 items-center justify-center self-start bg-neu-900 px-8 py-2">
9395
<span className="typography-button text-neu-0">
94-
Go to {isNext ? "next" : "previous"} lesson
96+
Go to {isNext ? "next" : "previous"} {articleNoun}
9597
</span>
9698
</div>
9799
</div>
98100

99101
{pageData?.icon && (
100-
<div className="relative flex size-[222px] bg-neu-0/[.64] backdrop-blur-[6px]">
102+
<div className="relative hidden size-[222px] bg-neu-0/[.64] backdrop-blur-[6px] @[680px]:flex">
101103
<div
102104
className={clsx(
103105
"shrink-0 items-center justify-center p-12",

src/components/nextra-mdx-wrapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function Body({ children }: { children: ReactNode }): ReactElement {
116116
<LearnNavLinkCard
117117
flatDocsDirectories={flatDocsDirectories}
118118
currentIndex={activeIndex}
119+
articleNoun="lesson"
119120
/>
120121
) : (
121122
<ArrowNavLinks

0 commit comments

Comments
 (0)