Skip to content

Commit

Permalink
feat(intro): add support for page title and toggle image on theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinperaza committed Dec 14, 2022
1 parent 544ac1e commit 684925b
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 39 deletions.
11 changes: 7 additions & 4 deletions docs/api.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: API Reference
hide_title: true
hide_table_of_contents: true
---

Expand All @@ -10,11 +11,13 @@ import { Alert, Alerts } from "@site/src/components/shared/Alert";

import { Intro } from "@site/src/components/shared/Intro";

import Image from "@site/static/img/api.svg";

<Intro
<Intro
title="API Reference"
caption="API endpoints to manage the full lifecycle of your data and Basis Theory instance."
img={<Image />}
img={{
light: "/img/api-reference/logo.svg",
dark: "/img/api-reference/logo-dark.svg",
}}
/>

The Basis Theory API is organized around REST. Our API is built with a predictable resource-oriented structure, uses JSON-encoded requests and responses, follows standard HTTP verbs/responses, and uses industry standard authentication.
Expand Down
13 changes: 7 additions & 6 deletions docs/blueprints/cards/index.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
hide_title: true
hide_table_of_contents: true
---

import { Intro } from "@site/src/components/shared/Intro";

import Image from "@site/static/img/api.svg";

# Cards Blueprints

<Intro
<Intro
title="Cards Blueprints"
caption="Blueprints to help you meet or reduce PCI compliance scope"
img={<Image />}
img={{
light: "/img/getting-started/blueprints/cards/logo.svg",
dark: "/img/getting-started/blueprints/cards/logo-dark.svg",
}}
/>

Payment Card Industry Data Security Standard (PCI DSS) is a set of compliance requirements that must be met to collect, store, and process cardholder data. To fully implement these requirements is both costly and time intensive.
Expand Down
10 changes: 6 additions & 4 deletions docs/expressions/index.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
title: Expressions
hide_title: true
hide_table_of_contents: true
---

import { Intro } from "@site/src/components/shared/Intro";
import Image from "@site/static/img/expressions.svg";

# Expressions

<Intro
title="Expressions"
caption="Explore the expression language used throughout the Basis Theory API."
img={<Image />}
img={{
light: "/img/getting-started/expressions/logo.svg",
dark: "/img/getting-started/expressions/logo-dark.svg",
}}
/>

** Explore the expression language used throughout the Basis Theory API. **
Expand Down
13 changes: 7 additions & 6 deletions docs/guides/collect/index.mdx
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",
}}
/>

12 changes: 8 additions & 4 deletions docs/guides/share/index.mdx
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",
}}
/>
8 changes: 6 additions & 2 deletions docs/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Getting Started
hide_title: true
sidebar_label: Getting Started
hide_table_of_contents: true
---
Expand All @@ -11,15 +12,18 @@ import { AuthButtons } from "@site/src/components/docs/AuthButtons";

import Link from "@docusaurus/Link";

import Image from "@site/static/img/getting-started.svg";
import BasisTheoryIcon from "@site/static/img/docs/bt-icon.svg";
import ExpressionsIcon from "@site/static/img/docs/expressions-icon.svg";
import ApplicationsIcon from "@site/static/img/docs/applications-icon.svg";
import Blueprints from "@site/static/img/docs/blueprints.svg";

<Intro
title="Getting Started"
caption="Basis Theory provides APIs, SDKs, and all of the tools you need to make your sensitive data more secure and usable."
img={<Image />}
img={{
light: "/img/getting-started/logo.svg",
dark: "/img/getting-started/logo-dark.svg",
}}
/>

## What is Basis Theory?
Expand Down
9 changes: 6 additions & 3 deletions docs/sdks.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
title: Basis Theory SDKs
sidebar_label: Overview
hide_title: true
hide_table_of_contents: true
---

import { Intro } from "@site/src/components/shared/Intro";
import { SdkCard } from "@site/src/components/sdks/SdkCard";
import { SDK } from "@site/src/components/types";

import Image from "@site/static/img/sdk.svg";

<Intro
title="Basis Theory SDKs"
caption="Libraries and tools for interacting with your Basis Theory integration."
img={<Image />}
img={{
light: "/img/sdk/logo.svg",
dark: "/img/sdk/logo-dark.svg",
}}
/>

## Server-side SDKs
Expand Down
12 changes: 6 additions & 6 deletions src/components/shared/Intro.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.container {
display: flex;
height: 100px;
place-content: space-between;
padding: 0px 0px 24px;
margin-bottom: 40px;
Expand All @@ -14,8 +13,11 @@
}

.img-container {
position: relative;
top: -150px;
background: var(--bt-intro-image-background) no-repeat -83px -87px;
}

.img-container img {
max-width: none;
}

@media only screen and (max-width: 600px) {
Expand All @@ -30,8 +32,6 @@
}

.img-container {
display: inherit;
position: unset;
place-content: center;
display: none;
}
}
35 changes: 31 additions & 4 deletions src/components/shared/Intro.tsx
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>
);
};
7 changes: 7 additions & 0 deletions src/css/bt-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
/* Search */

--bt-search-border-color: #cfd3e8;

/* intro */

--bt-intro-image-background: url("data:image/svg+xml,%3Csvg width='280' height='280' viewBox='0 0 280 280' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M172.578 140H140M172.578 140H192.125M172.578 140V119.367M172.578 140H226.875M172.578 140V172.578M172.578 140H279M140 140V107.422M140 140H107.422M140 140V172.578M279 140H192.125M279 140V53.125M279 140H226.875M279 140V279H226.875M140 107.422V53.125M140 107.422H172.578M140 107.422V87.875M140 107.422H119.367M140 107.422V1M192.125 140V119.367M279 53.125V1H140M279 53.125H192.125M140 1V53.125M140 1V87.875M140 1H53.125M140 53.125H192.125M192.125 53.125V107.422M192.125 107.422H180.18M192.125 107.422V119.367M172.578 107.422H180.18M172.578 107.422V119.367M180.18 107.422V119.367M180.18 119.367H172.578M180.18 119.367H192.125M107.422 140H53.125M107.422 140V107.422M107.422 140H87.875M107.422 140V160.633M107.422 140H1M140 87.875H119.367M53.125 1H1V140M53.125 1V87.875M1 140H53.125M1 140H87.875M1 140V226.875M53.125 140V87.875M53.125 87.875H107.422M107.422 87.875V99.8203M107.422 87.875H119.367M107.422 107.422V99.8203M107.422 107.422H119.367M107.422 99.8203H119.367M119.367 99.8203V107.422M119.367 99.8203V87.875M140 172.578V192.125M140 172.578H160.633M140 172.578V226.875M140 172.578H107.422M140 172.578V279M140 279V192.125M140 279H226.875M140 279V226.875M140 279H1V226.875M140 192.125H160.633M226.875 279V192.125M226.875 140V192.125M226.875 192.125H172.578M172.578 192.125V180.18M172.578 192.125H160.633M172.578 172.578V180.18M172.578 172.578H160.633M172.578 180.18H160.633M160.633 180.18V172.578M160.633 180.18V192.125M87.875 140V160.633M1 226.875H87.875M140 226.875H87.875M87.875 226.875V172.578M87.875 172.578H99.8203M87.875 172.578V160.633M107.422 172.578H99.8203M107.422 172.578V160.633M99.8203 172.578V160.633M99.8203 160.633H107.422M99.8203 160.633H87.875' stroke='url(%23paint0_radial_773_20104)' stroke-width='1.31132' /%3E%3Cdefs%3E%3CradialGradient id='paint0_radial_773_20104' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(140 140.5) rotate(45) scale(63.6396 86.0615)'%3E%3Cstop stop-color='%23E0E7FF' /%3E%3Cstop offset='1' stop-color='%23E0E7FF' stop-opacity='0' /%3E%3C/radialGradient%3E%3C/defs%3E%3C/svg%3E");
}

/* For readability concerns you should choose a lighter palette in dark mode. */
Expand Down Expand Up @@ -124,4 +128,7 @@

/* Search */
--bt-search-border-color: rgba(209, 215, 255, 0.15);

/* intro */
--bt-intro-image-background: url("data:image/svg+xml,%3Csvg width='280' height='279' viewBox='0 0 280 279' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath opacity='0.2' d='M172.578 139.5H140M172.578 139.5H192.125M172.578 139.5V118.867M172.578 139.5H226.875M172.578 139.5V172.078M172.578 139.5H279M140 139.5V106.922M140 139.5H107.422M140 139.5V172.078M279 139.5H192.125M279 139.5V52.625M279 139.5H226.875M279 139.5V278.5H226.875M140 106.922V52.625M140 106.922H172.578M140 106.922V87.375M140 106.922H119.367M140 106.922V0.5M192.125 139.5V118.867M279 52.625V0.5H140M279 52.625H192.125M140 0.5V52.625M140 0.5V87.375M140 0.5H53.125M140 52.625H192.125M192.125 52.625V106.922M192.125 106.922H180.18M192.125 106.922V118.867M172.578 106.922H180.18M172.578 106.922V118.867M180.18 106.922V118.867M180.18 118.867H172.578M180.18 118.867H192.125M107.422 139.5H53.125M107.422 139.5V106.922M107.422 139.5H87.875M107.422 139.5V160.133M107.422 139.5H1M140 87.375H119.367M53.125 0.5H1V139.5M53.125 0.5V87.375M1 139.5H53.125M1 139.5H87.875M1 139.5V226.375M53.125 139.5V87.375M53.125 87.375H107.422M107.422 87.375V99.3203M107.422 87.375H119.367M107.422 106.922V99.3203M107.422 106.922H119.367M107.422 99.3203H119.367M119.367 99.3203V106.922M119.367 99.3203V87.375M140 172.078V191.625M140 172.078H160.633M140 172.078V226.375M140 172.078H107.422M140 172.078V278.5M140 278.5V191.625M140 278.5H226.875M140 278.5V226.375M140 278.5H1V226.375M140 191.625H160.633M226.875 278.5V191.625M226.875 139.5V191.625M226.875 191.625H172.578M172.578 191.625V179.68M172.578 191.625H160.633M172.578 172.078V179.68M172.578 172.078H160.633M172.578 179.68H160.633M160.633 179.68V172.078M160.633 179.68V191.625M87.875 139.5V160.133M1 226.375H87.875M140 226.375H87.875M87.875 226.375V172.078M87.875 172.078H99.8203M87.875 172.078V160.133M107.422 172.078H99.8203M107.422 172.078V160.133M99.8203 172.078V160.133M99.8203 160.133H107.422M99.8203 160.133H87.875' stroke='url(%23paint0_radial_773_20388)' /%3E%3Cdefs%3E%3CradialGradient id='paint0_radial_773_20388' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(140 140) rotate(45) scale(63.6396 86.0615)'%3E%3Cstop stop-color='%23E0E7FF' /%3E%3Cstop offset='1' stop-color='%23E0E7FF' stop-opacity='0' /%3E%3C/radialGradient%3E%3C/defs%3E%3C/svg%3E");
}

1 comment on commit 684925b

@vercel
Copy link

@vercel vercel bot commented on 684925b Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.