-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* `color` prop for icon * Refactor GridTableOfContents to use icon color prop * `gridTOC` frontmatter data * GridTableOfContents component * Use GridTableOfContents in App * Use $min-font-size in global.scss * Fix styling for grid TOC * Rename GridTableOfContents to QuickLinks * Remove demo data * Fix quick links grid gap
- Loading branch information
1 parent
f631dc9
commit a340f18
Showing
11 changed files
with
76 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import clsx from 'clsx'; | ||
|
||
import { ExternalLink } from '@/components/icons'; | ||
import { Link } from '@/components/Link'; | ||
import { useJupyterBookData } from '@/context/jupyterBook'; | ||
import { isExternalUrl } from '@/utils/url'; | ||
|
||
/** | ||
* Renders a grid of table of content items with descriptions. The `quickLinks` | ||
* frontmatter configuration is used for rendering quick link items. | ||
*/ | ||
export function QuickLinks() { | ||
const { | ||
pageFrontMatter: { quickLinks }, | ||
} = useJupyterBookData(); | ||
|
||
if (!quickLinks) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ul | ||
className={clsx( | ||
'grid gap-6 screen-495:gap-12 justify-center', | ||
'grid-cols-3 screen-875:grid-cols-5', | ||
)} | ||
> | ||
{quickLinks.map((item) => { | ||
const isExternal = isExternalUrl(item.url); | ||
|
||
return ( | ||
<li key={item.url}> | ||
{/* Title and icon container */} | ||
<div className="flex items-center"> | ||
<Link | ||
className="underline font-semibold text-[17px]" | ||
href={item.url} | ||
newTab={isExternal} | ||
> | ||
{item.title} | ||
</Link> | ||
|
||
{isExternal && ( | ||
<ExternalLink className="ml-2 w-3 h-3" color="#000" /> | ||
)} | ||
</div> | ||
|
||
{/* Quick link item content */} | ||
<p className="text-sm mt-4">{item.content}</p> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
); | ||
} |
5 changes: 0 additions & 5 deletions
5
theme/src/components/TableOfContents/GlobalTableOfContents.module.scss
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
theme/src/components/TableOfContents/GlobalTableOfContents.module.scss.d.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './GlobalTableOfContents'; | ||
export * from './SubPageTableOfContents'; | ||
export * from './TableOfContents'; | ||
export * from './TableOfContents.constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export interface IconProps { | ||
className?: string; | ||
color?: string; | ||
alt?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters