-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
155 additions
and
0 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
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,75 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import Link from '@docusaurus/Link'; | ||
import { findFirstSidebarItemLink, useDocById } from '@docusaurus/theme-common/internal'; | ||
import isInternalUrl from '@docusaurus/isInternalUrl'; | ||
import { translate } from '@docusaurus/Translate'; | ||
import Heading from '@theme/Heading'; | ||
import styles from './styles.module.css'; | ||
|
||
function CardContainer({ href, children }) { | ||
return ( | ||
<Link href={href} className={clsx('card padding--lg', styles.cardContainer)}> | ||
{children} | ||
</Link> | ||
); | ||
} | ||
|
||
function CardLayout({ href, icon, title, description }) { | ||
return ( | ||
<CardContainer href={href}> | ||
<Heading as="h2" className={clsx('text--truncate', styles.cardTitle)} title={title}> | ||
{icon} {title} | ||
</Heading> | ||
{description && ( | ||
<p className={clsx('text--truncate', styles.cardDescription)} title={description}> | ||
{description} | ||
</p> | ||
)} | ||
</CardContainer> | ||
); | ||
} | ||
|
||
function CardCategory({ item }) { | ||
const icon = item.customProps?.icon ?? '🗃️'; | ||
const href = findFirstSidebarItemLink(item); | ||
// Unexpected: categories that don't have a link have been filtered upfront | ||
if (!href) { | ||
return null; | ||
} | ||
return ( | ||
<CardLayout | ||
href={href} | ||
icon={icon} | ||
title={item.label} | ||
description={ | ||
item.description ?? | ||
translate( | ||
{ | ||
message: '{count} items', | ||
id: 'theme.docs.DocCard.categoryDescription', | ||
description: 'The default description for a category card in the generated index about how many items this category includes', | ||
}, | ||
{ count: item.items.length } | ||
) | ||
} | ||
/> | ||
); | ||
} | ||
|
||
function CardLink({ item }) { | ||
const icon = item.customProps?.icon ?? (isInternalUrl(item.href) ? '📄️' : '🔗'); | ||
const doc = useDocById(item.docId ?? undefined); | ||
return <CardLayout href={item.href} icon={icon} title={item.label} description={item.description ?? doc?.description} />; | ||
} | ||
|
||
export default function DocCard({ item }) { | ||
switch (item.type) { | ||
case 'link': | ||
return <CardLink item={item} />; | ||
case 'category': | ||
return <CardCategory item={item} />; | ||
default: | ||
throw new Error(`unknown item type ${JSON.stringify(item)}`); | ||
} | ||
} |
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,27 @@ | ||
.cardContainer { | ||
--ifm-link-color: var(--ifm-color-emphasis-800); | ||
--ifm-link-hover-color: var(--ifm-color-emphasis-700); | ||
--ifm-link-hover-decoration: none; | ||
|
||
box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%); | ||
border: 1px solid var(--ifm-color-emphasis-200); | ||
transition: all var(--ifm-transition-fast) ease; | ||
transition-property: border, box-shadow; | ||
} | ||
|
||
.cardContainer:hover { | ||
border-color: var(--ifm-color-primary); | ||
box-shadow: 0 3px 6px 0 rgb(0 0 0 / 20%); | ||
} | ||
|
||
.cardContainer *:last-child { | ||
margin-bottom: 0; | ||
} | ||
|
||
.cardTitle { | ||
font-size: 1.2rem; | ||
} | ||
|
||
.cardDescription { | ||
font-size: 0.8rem; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 +1,7 @@ | ||
--- | ||
sidebar_custom_props: { icon: '▶️' } | ||
--- | ||
|
||
# Basic player | ||
|
||
import useBaseUrl from '@docusaurus/useBaseUrl'; | ||
|
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,6 +1,7 @@ | ||
--- | ||
sidebar_position: 1 | ||
sidebar_label: Web | ||
sidebar_custom_props: { icon: '🌐' } | ||
--- | ||
|
||
# Getting started on Web | ||
|
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,5 +1,6 @@ | ||
--- | ||
sidebar_position: 1 | ||
sidebar_custom_props: { icon: '💰' } | ||
--- | ||
|
||
# Advertisements | ||
|