Skip to content

Commit 6f622f3

Browse files
tiger d5 follow (supabase#30975)
* hackathon link * fix wide blog imgs mobile * mobile sticky nav * escape # in toc
1 parent 5f690bf commit 6f622f3

File tree

4 files changed

+80
-8
lines changed

4 files changed

+80
-8
lines changed

apps/www/components/LaunchWeek/13/Releases/LWStickyNav.tsx

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
import React, { FC, useEffect, useRef } from 'react'
1+
import React, { FC, useEffect, useRef, useState } from 'react'
22
import Link from 'next/link'
33
import { WeekDayProps, mainDays } from './data'
4-
import { cn } from 'ui'
4+
import {
5+
Button,
6+
cn,
7+
DropdownMenu,
8+
DropdownMenuContent,
9+
DropdownMenuItem,
10+
DropdownMenuTrigger,
11+
} from 'ui'
512
import { isBrowser } from 'common'
613

714
import SectionContainer from '~/components/Layouts/SectionContainer'
8-
import { ArrowUpRight } from 'lucide-react'
15+
import { ArrowUpRight, ChevronDown } from 'lucide-react'
16+
import { startCase } from 'lodash'
917

1018
const LWXStickyNav: FC = () => {
1119
const days = mainDays()
20+
const [activeNavItem, setActiveNavItem] = useState('Mon')
1221

1322
const OFFSET = 66
1423
const anchors = useRef<NodeListOf<HTMLHeadingElement> | null>(null)
@@ -22,6 +31,14 @@ const LWXStickyNav: FC = () => {
2231

2332
if (offsetFromTop - OFFSET < 0) {
2433
newActiveAnchor = anchor.id
34+
35+
// Set the active nav item based on the anchor ID
36+
const matchingDay = days.find((day) => day.id === newActiveAnchor)
37+
if (matchingDay) {
38+
setActiveNavItem(matchingDay.dd)
39+
} else if (newActiveAnchor === 'build-stage') {
40+
setActiveNavItem('Build Stage')
41+
}
2542
}
2643
})
2744

@@ -56,13 +73,50 @@ const LWXStickyNav: FC = () => {
5673
<nav className="sticky z-30 top-0 bg-default/30 dark:bg-default/90 backdrop-blur-md w-full border-b dark:border-muted h-[60px] flex items-center">
5774
<SectionContainer className="!max-w-none !py-0 lg:!container flex items-center justify-between font-mono gap-4 md:gap-8 text-sm">
5875
<div className="w-full flex items-center gap-4 md:gap-8">
76+
<DropdownMenu>
77+
<DropdownMenuTrigger asChild>
78+
<Button
79+
type="outline"
80+
iconRight={<ChevronDown />}
81+
className="md:hidden w-[200px] min-w-[150px] flex justify-between items-center py-2 pointer-events-auto"
82+
>
83+
<span className="flex gap-1 items-center">
84+
{activeNavItem}
85+
{activeNavItem === 'Fri' && (
86+
<span
87+
title="Live"
88+
className="w-1 h-1 ml-1 animate-pulse rounded-full bg-brand mb-2 block"
89+
/>
90+
)}
91+
</span>
92+
</Button>
93+
</DropdownMenuTrigger>
94+
<DropdownMenuContent side="bottom" align="start" className="pointer-events-auto">
95+
{days.map((day) => (
96+
<DropdownMenuItem key={day.id} asChild>
97+
<Link href={`#${day.id}`} className="flex items-center gap-2">
98+
{day.dd}
99+
{day.isToday && (
100+
<span
101+
title="Live"
102+
className="w-1 h-1 animate-pulse rounded-full bg-brand block"
103+
/>
104+
)}
105+
</Link>
106+
</DropdownMenuItem>
107+
))}
108+
<DropdownMenuItem asChild>
109+
<Link href="#build-stage">Build Stage</Link>
110+
</DropdownMenuItem>
111+
</DropdownMenuContent>
112+
</DropdownMenu>
59113
<ul className="w-full lw-sticky-nav flex items-center gap-2 md:gap-4 text-foreground-lighter">
60114
{days.map((day: WeekDayProps) => (
61115
<li key={day.id}>
62116
<Link
63117
href={`#${day.id}`}
64118
className={cn(
65-
'p-1 transition-colors text-foreground-muted hover:text-foreground flex items-center pointer-events-auto',
119+
'hidden p-1 transition-colors text-foreground-muted hover:text-foreground md:flex items-center pointer-events-auto',
66120
(day.isToday || day.shipped) && 'text-foreground-light'
67121
)}
68122
>
@@ -79,12 +133,24 @@ const LWXStickyNav: FC = () => {
79133
<li>
80134
<Link
81135
href="#build-stage"
82-
className="p-1 transition-colors hover:text-foreground pointer-events-auto lw-sticky-nav"
136+
className="hidden md:block p-1 transition-colors hover:text-foreground pointer-events-auto lw-sticky-nav"
83137
>
84138
Build <span className="hidden sm:inline">Stage</span>
85139
</Link>
86140
</li>
87141
<div className="flex items-center justify-end gap-2 md:gap-4 flex-1">
142+
<li>
143+
<Link
144+
href="/events/launch-week-13-hackathon"
145+
target="_blank"
146+
className="p-1 transition-colors hover:text-foreground pointer-events-auto flex gap-1"
147+
>
148+
Hackathon{' '}
149+
<span>
150+
<ArrowUpRight className="w-4 h-5 text-foreground-muted" />
151+
</span>
152+
</Link>
153+
</li>
88154
<li>
89155
<Link
90156
href="/events?category=meetup"

apps/www/pages/blog/[slug].tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export const getStaticProps: GetStaticProps<BlogPostPageProps, Params> = async (
107107
const nextPost = allPosts[currentIndex + 1]
108108
const prevPost = allPosts[currentIndex - 1]
109109

110+
const tocResult = toc(content, { maxdepth: data.toc_depth ? data.toc_depth : 2 })
111+
const processedContent = tocResult.content.replace(/%23/g, '')
112+
110113
return {
111114
props: {
112115
prevPost: currentIndex === 0 ? null : prevPost ? prevPost : null,
@@ -117,7 +120,10 @@ export const getStaticProps: GetStaticProps<BlogPostPageProps, Params> = async (
117120
source: content,
118121
...data,
119122
content: mdxSource,
120-
toc: toc(content, { maxdepth: data.toc_depth ? data.toc_depth : 2 }),
123+
toc: {
124+
...tocResult,
125+
content: processedContent,
126+
},
121127
},
122128
},
123129
}

apps/www/styles/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ table {
269269
}
270270
.next-image--dynamic-fill.wide,
271271
video.wide {
272-
@apply my-0 max-w-none -mx-8 w-[calc(100%_+_4rem)];
272+
@apply sm:my-0 sm:max-w-none sm:-mx-8 sm:w-[calc(100%_+_4rem)];
273273
}
274274
@media (min-width: 560px) {
275275
.next-image--dynamic-fill.wide,

packages/ui-patterns/ExpandableVideo/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function ExpandableVideo({
108108
>
109109
<p className="text-xs">Close</p>
110110
</button>
111-
<div className="video-container !rounded overflow-hidden">
111+
<div className="video-container !rounded-lg !border-none !overflow-hidden">
112112
<iframe
113113
src={`https://www.youtube-nocookie.com/embed/${videoId}`}
114114
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"

0 commit comments

Comments
 (0)