-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(intro): add support for page title and toggle image on theme change
- Loading branch information
1 parent
544ac1e
commit 684925b
Showing
10 changed files
with
91 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
--- | ||
hide_title: true | ||
hide_table_of_contents: true | ||
--- | ||
|
||
import Image from "@site/static/img/collect-data.svg"; | ||
import { Intro } from "@site/src/components/shared/Intro"; | ||
|
||
# Collect Data | ||
|
||
<Intro | ||
<Intro | ||
title="Collect Data" | ||
caption="Collect data from your browser, device, or API." | ||
img={<Image />} | ||
img={{ | ||
light: "/img/getting-started/guides/collect/logo.svg", | ||
dark: "/img/getting-started/guides/collect/logo-dark.svg", | ||
}} | ||
/> | ||
|
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,11 +1,15 @@ | ||
--- | ||
hide_title: true | ||
hide_table_of_contents: true | ||
--- | ||
|
||
import { Intro } from "@site/src/components/shared/Intro"; | ||
|
||
# Share Data | ||
|
||
<Intro | ||
<Intro | ||
title="Share Data" | ||
caption="Send data to third parties or reveal in your browser or device." | ||
/> | ||
img={{ | ||
light: "/img/getting-started/guides/share/logo.svg", | ||
dark: "/img/getting-started/guides/share/logo-dark.svg", | ||
}} | ||
/> |
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 |
---|---|---|
@@ -1,12 +1,39 @@ | ||
import React from "react"; | ||
import React, { ComponentProps } from "react"; | ||
|
||
import styles from "./Intro.module.css"; | ||
import ThemedImage from "@theme/ThemedImage"; | ||
import useBaseUrl from "@docusaurus/useBaseUrl"; | ||
|
||
export const Intro = ({ caption, img }) => { | ||
type Sources = ComponentProps<typeof ThemedImage>["sources"]; | ||
interface Intro { | ||
title: string; | ||
caption: string; | ||
img?: React.ReactNode | Sources; | ||
} | ||
|
||
const hasSources = (val: unknown): val is Sources => | ||
!!(val as Sources).light && !!(val as Sources).dark; | ||
|
||
export const Intro = ({ title, caption, img }: Intro) => { | ||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.content}>{caption}</div> | ||
<div className={styles["img-container"]}>{img}</div> | ||
<div className={styles.content}> | ||
{title && <h1>{title}</h1>} | ||
{caption} | ||
</div> | ||
<div className={styles["img-container"]}> | ||
{hasSources(img) ? ( | ||
<ThemedImage | ||
alt="Docusaurus themed image" | ||
sources={{ | ||
light: useBaseUrl(img.light), | ||
dark: useBaseUrl(img.dark), | ||
}} | ||
/> | ||
) : ( | ||
img | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
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
684925b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
developers-basistheory-com – ./
developers-basistheory-com-git-master-basis-theory.vercel.app
developers-basistheory-com.vercel.app
developers-basistheory-com-basis-theory.vercel.app