Skip to content

Commit aeeab92

Browse files
authored
Migrate theme to use npm package (interledger#1916)
1 parent c9c047e commit aeeab92

28 files changed

+108
-967
lines changed

packages/documentation/README.md

+69-8
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,25 @@ Refer to the Starlight documentation on [authoring content](https://starlight.as
5252

5353
### Docs components
5454

55-
We have extracted some of the commonly repeated patterns within the documentation pages into custom docs components that can be reused.
55+
We have extracted some of the commonly repeated patterns within the documentation pages into custom docs components that can be reused. There are components which are shared across all our Starlight documentation sites and those which are specific to Web Monetization only. This will determine what the import path is.
5656

5757
- [CodeBlock](#codeblock-component)
5858
- [Disclosure](#disclosure-component)
5959
- [Hidden](#hidden-component)
6060
- [LargeImg](#largeimg-component)
6161
- [LinkOut](#linkout-component)
62+
- [MermaidWrapper](#mermaidwrapper-component)
6263
- [StylishHeader](#stylishheader-component)
6364
- [Tooltip](#tooltip-component)
6465

66+
For more information about importing things in Javascript, please refer to [import on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
67+
6568
1. #### `CodeBlock` component
6669

6770
Use this component if you wish to add a title to your code block. It takes a `title` attribute, which will be displayed above the code. To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `CodeBlock` component like so:
6871

69-
```
70-
import CodeBlock from '/src/components/docs/CodeBlock'
72+
```jsx
73+
import { CodeBlock } from '@interledger/docs-design-system'
7174
```
7275

7376
Use the `<CodeBlock>` component within your content like so:
@@ -100,7 +103,7 @@ We have extracted some of the commonly repeated patterns within the documentatio
100103
To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `Disclosure` component like so:
101104

102105
```jsx
103-
import Disclosure from '/src/components/docs/Disclosure'
106+
import { Disclosure } from '@interledger/docs-design-system'
104107
```
105108

106109
Use the `<Disclosure>` component within your content like so:
@@ -145,6 +148,10 @@ We have extracted some of the commonly repeated patterns within the documentatio
145148

146149
Use this component to hide content that is temporarily not ready to be shown to the public. This is not meant for long-term use, but a stop-gap when the current implementation is still far away from our documentation/specifications, and the content we have will be relevant but in the future.
147150

151+
```jsx
152+
import { Hidden } from '@interledger/docs-design-system'
153+
```
154+
148155
Unfortunately, due to the nature of how the ToC on the right is generated, if we want to hide an entire section (including the header), we will have to manually hide the section heading by either commenting it out or deleting it.
149156

150157
1. #### `LargeImg` component
@@ -154,7 +161,7 @@ We have extracted some of the commonly repeated patterns within the documentatio
154161
To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `LargeImg` component like so:
155162

156163
```jsx
157-
import LargeImg from '/src/components/docs/LargeImg'
164+
import { LargeImg } from '@interledger/docs-design-system'
158165
```
159166

160167
Use the `<LargeImg>` component within your content like so:
@@ -163,6 +170,16 @@ We have extracted some of the commonly repeated patterns within the documentatio
163170
<LargeImg src='/img/OMG_A_GIGANTIC_IMG.png' alt='A really large diagram' />
164171
```
165172

173+
By default, there will be a border around the image, but if you want to remove the border, pass in a `hasBorder={false}` attribute.
174+
175+
```jsx
176+
<LargeImg
177+
src='/img/OMG_A_GIGANTIC_IMG.png'
178+
alt='A really large diagram'
179+
hasBorder={false}
180+
/>
181+
```
182+
166183
For user doc diagrams, be sure to include the `docs` folder in the path.
167184

168185
```jsx
@@ -179,7 +196,7 @@ We have extracted some of the commonly repeated patterns within the documentatio
179196
To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `LinkOut` component like so:
180197

181198
```jsx
182-
import LinkOut from '/src/components/docs/LinkOut'
199+
import { LinkOut } from '@interledger/docs-design-system'
183200
```
184201

185202
Use the `<LinkOut>` component within your content like so:
@@ -196,12 +213,56 @@ We have extracted some of the commonly repeated patterns within the documentatio
196213
</LinkOut>
197214
```
198215

216+
1. #### `MermaidWrapper` component
217+
218+
Use this component if your Mermaid diagram is much larger than our available space and you would like users to view the full diagram in another tab. This adds "View full diagram" button with an external link indicator on the bottom right corner under the diagram. Note that the `client:load` attribute is required for the functionality to work because this component relies on state.
219+
220+
To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `MermaidWrapper` component like so:
221+
222+
```jsx
223+
import { MermaidWrapper } from '@interledger/docs-design-system'
224+
```
225+
226+
Use the `<MermaidWrapper>` component within your content like so:
227+
228+
````jsx
229+
<MermaidWrapper client:load>
230+
```mermaid sequenceDiagram Alice ->> Bob: Hello Bob, how are you?
231+
Bob-->>John: How about you John? Bob--x Alice: I am good thanks! Bob-x
232+
John: I am good thanks! Note right of John: Bob thinks a long
233+
<br />
234+
long time, so long
235+
<br />
236+
that the text does
237+
<br />
238+
not fit on a row. Bob-->Alice: Checking with John... Alice->John: Yes...
239+
John, how are you? ```
240+
</MermaidWrapper>
241+
````
242+
243+
By default, there will be a border around the image, but if you want to remove the border, pass in a `hasBorder={false}` attribute.
244+
245+
````jsx
246+
<MermaidWrapper client:load hasBorder={false}>
247+
```mermaid sequenceDiagram Alice ->> Bob: Hello Bob, how are you?
248+
Bob-->>John: How about you John? Bob--x Alice: I am good thanks! Bob-x
249+
John: I am good thanks! Note right of John: Bob thinks a long
250+
<br />
251+
long time, so long
252+
<br />
253+
that the text does
254+
<br />
255+
not fit on a row. Bob-->Alice: Checking with John... Alice->John: Yes...
256+
John, how are you? ```
257+
</MermaidWrapper>
258+
````
259+
199260
1. #### `StylishHeader` component
200261

201262
Use this component if you wish to create a stylized heading that does not use the heading elements such that it will not appear in the ToC right sidebar. To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `StylishHeader` component like so:
202263

203264
```jsx
204-
import StylishHeader from '/src/components/docs/StylishHeader'
265+
import { StylishHeader } from '@interledger/docs-design-system'
205266
```
206267

207268
Use the `<StylishHeader>` component within your content like so:
@@ -217,7 +278,7 @@ We have extracted some of the commonly repeated patterns within the documentatio
217278
To use it, your docs page must be in `.mdx` format. Please change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue. Import the `Tooltip` component like so:
218279
219280
```jsx
220-
import Tooltip from '/src/components/docs/Tooltip'
281+
import { Tooltip } from '@interledger/docs-design-system'
221282
```
222283
223284
Use the `<Tooltip>` component within your content like so:

packages/documentation/astro.config.mjs

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ export default defineConfig({
2020
// overrideIntegration(), # TODO: figure out the path problem for this plugin
2121
starlight({
2222
title: 'Rafiki',
23-
customCss: ['./src/styles/ilf-docs.css', './src/styles/rafiki.css'],
23+
customCss: [
24+
'./node_modules/@interledger/docs-design-system/src/styles/orange-theme.css',
25+
'./node_modules/@interledger/docs-design-system/src/styles/ilf-docs.css',
26+
'./src/styles/rafiki.css'
27+
],
2428
head: [
2529
{
2630
tag: 'script',

packages/documentation/docs/apis/auth/enums.md

-70
This file was deleted.

packages/documentation/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
"dependencies": {
1212
"@astrojs/react": "^3.0.2",
1313
"@astrojs/starlight": "^0.10.0",
14+
"@interledger/docs-design-system": "^0.0.12",
1415
"@types/react": "^18.2.22",
1516
"@types/react-dom": "^18.2.7",
16-
"astro": "3.1.0",
17-
"astro-graphql-plugin": "^0.0.9",
18-
"graphql": "^16.8.1",
17+
"astro": "3.1.1",
18+
"astro-graphql-plugin": "^0.1.0",
19+
"graphql": "^16.8.0",
1920
"react": "^18.2.0",
2021
"react-dom": "^18.2.0",
2122
"rehype-mathjax": "^4.0.3",

packages/documentation/src/components/.keepme

Whitespace-only changes.

packages/documentation/src/components/docs/CodeBlock/CodeBlock.jsx

-58
This file was deleted.

packages/documentation/src/components/docs/CodeBlock/CodeBlock.module.css

-81
This file was deleted.

packages/documentation/src/components/docs/CodeBlock/index.js

-3
This file was deleted.

0 commit comments

Comments
 (0)