11'use client' ;
22
3- import type { SiteSection } from '@gitbook/api' ;
43import { Icon , type IconName } from '@gitbook/icons' ;
54import * as NavigationMenu from '@radix-ui/react-navigation-menu' ;
65import React from 'react' ;
76
87import { Link } from '@/components/primitives' ;
9- import type { SectionsList } from '@/lib/api' ;
108import { tcls } from '@/lib/tailwind' ;
119
1210import { SectionIcon } from './SectionIcon' ;
11+ import type { ClientSiteSection , ClientSiteSections } from './encodeClientSiteSections' ;
1312
1413const VIEWPORT_ITEM_WIDTH = 240 ; /* width of the tile (w-60) */
1514const MIN_ITEMS_FOR_COLS = 4 ; /* number of items to switch to 2 columns */
1615/**
1716 * A set of navigational links representing site sections for multi-section sites
1817 */
19- export function SiteSectionTabs ( props : { sections : SectionsList } ) {
18+ export function SiteSectionTabs ( props : { sections : ClientSiteSections } ) {
2019 const {
2120 sections : { list : sectionsAndGroups , current : currentSection } ,
2221 } = props ;
@@ -91,9 +90,7 @@ export function SiteSectionTabs(props: { sections: SectionsList }) {
9190 </ NavigationMenu . Trigger >
9291 < NavigationMenu . Content className = "absolute top-0 left-0 z-20 w-full data-[motion=from-end]:motion-safe:animate-enterFromRight data-[motion=from-start]:motion-safe:animate-enterFromLeft data-[motion=to-end]:motion-safe:animate-exitToRight data-[motion=to-start]:motion-safe:animate-exitToLeft md:w-max" >
9392 < SectionGroupTileList
94- sections = {
95- sectionOrGroup . sections as SiteSection [ ]
96- }
93+ sections = { sectionOrGroup . sections }
9794 currentSection = { currentSection }
9895 />
9996 </ NavigationMenu . Content >
@@ -102,7 +99,7 @@ export function SiteSectionTabs(props: { sections: SectionsList }) {
10299 ) : (
103100 < NavigationMenu . Link asChild >
104101 < SectionTab
105- url = { sectionOrGroup . urls . published ?? '' }
102+ url = { sectionOrGroup . url }
106103 isActive = { isActive }
107104 title = { title }
108105 icon = { icon ? ( icon as IconName ) : undefined }
@@ -213,7 +210,10 @@ function ActiveTabIndicator() {
213210/**
214211 * A list of section tiles grouped in the dropdown for a section group
215212 */
216- function SectionGroupTileList ( props : { sections : SiteSection [ ] ; currentSection : SiteSection } ) {
213+ function SectionGroupTileList ( props : {
214+ sections : ClientSiteSection [ ] ;
215+ currentSection : ClientSiteSection ;
216+ } ) {
217217 const { sections, currentSection } = props ;
218218 return (
219219 < ul
@@ -236,13 +236,13 @@ function SectionGroupTileList(props: { sections: SiteSection[]; currentSection:
236236/**
237237 * A section tile shown in the dropdown for a section group
238238 */
239- function SectionGroupTile ( props : { section : SiteSection ; isActive : boolean } ) {
239+ function SectionGroupTile ( props : { section : ClientSiteSection ; isActive : boolean } ) {
240240 const { section, isActive } = props ;
241- const { urls , icon, title } = section ;
241+ const { url , icon, title } = section ;
242242 return (
243243 < li className = "flex w-full md:w-60" >
244244 < Link
245- href = { urls . published ?? '' }
245+ href = { url }
246246 className = { tcls (
247247 'flex min-h-12 w-full select-none flex-col gap-2 rounded p-3 transition-colors hover:bg-tint-hover' ,
248248 isActive
0 commit comments