Skip to content

Commit 25b7242

Browse files
authored
Merge pull request #2 from interledger/chj/resolve-breaking-changes-in-new-starlight
chore: resolve breaking changes in new Starlight
2 parents 216b3ed + 65843c2 commit 25b7242

File tree

3 files changed

+28
-228
lines changed

3 files changed

+28
-228
lines changed

README.md

Lines changed: 19 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -40,232 +40,32 @@ import { CodeBlock, Disclosure } from "@interledger/docs-design-system";
4040

4141
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).
4242

43-
1. #### `CodeBlock` component
43+
All the above components are documented at our [documentation style guide](https://interledger.tech).
4444

45-
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:
45+
## Contributing
4646

47-
```jsx
48-
import { CodeBlock } from "@interledger/docs-design-system";
49-
```
47+
As this is a shared library, it is a dependency for other projects, specifically all Interledger documentation websites. A good way to check who is using this library is via GitHub search: https://github.com/search?q=%22%40interledger%2Fdocs-design-system%22%3A+&type=code.
5048

51-
Use the `<CodeBlock>` component within your content like so:
49+
Our theme does override a number of Starlight defaults, therefore it is inevitable that if the Starlight internals are modified as they continue to release new features, we will have to make the corresponding updates to this library as well, to make sure nothing breaks. The documentation style guide is a good target to determine if the proposed changes you want to make to the library work correctly or not.
5250

53-
````
54-
<CodeBlock title="Response">
51+
The suggested workflow is as follows:
5552

56-
```http
57-
{
58-
"id":"https://wallet.example/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c",
59-
"paymentPointer":"https://wallet.example/alice",
60-
"receivedAmount": {
61-
"value":"0",
62-
"assetCode":"USD",
63-
"assetScale":2
64-
},
65-
"completed":false,
66-
"createdAt":"2022-03-12T23:20:50.52Z",
67-
"updatedAt":"2022-03-12T23:20:50.52Z",
68-
}
69-
```
53+
1. Clone both the documentation style guide and this library
7054

71-
</CodeBlock>
72-
````
73-
74-
1. #### `Disclosure` component
75-
76-
Use this component if you have some content that you want to show/hide via a collapsible container. This component wraps around whatever content you wish to have this expand/collapse behaviour. Note that the `client:load` attribute is required for the functionality to work because this component relies on state.
77-
78-
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:
79-
80-
```jsx
81-
import { Disclosure } from "@interledger/docs-design-system";
82-
```
83-
84-
Use the `<Disclosure>` component within your content like so:
85-
86-
```jsx
87-
<Disclosure toggleText='Show code snippets' client:load>
88-
<!-- Your content, can be markup or markdown -->
89-
</Disclosure>
90-
```
91-
92-
For the specific use-case of displaying multiple code-snippets, it might be worth considering also using the [built-in Starlight `<Tabs>`](https://starlight.astro.build/guides/components#tabs) component:
93-
94-
````jsx
95-
<Disclosure toggleText='Show code snippets' client:load>
96-
<Tabs>
97-
<TabItem label='Request'>
98-
```bash
99-
GET /alice HTTP/1.1
100-
Accept: application/json
101-
Host: wallet.example
102-
```
103-
</TabItem>
104-
<TabItem label='Response'>
105-
```bash
106-
HTTP/1.1 200 Success
107-
Content-Type: application/json
108-
109-
{
110-
"id":"https://wallet.example/alice",
111-
"assetCode":"USD",
112-
"assetScale":2,
113-
"authServer":"https://wallet.example/auth",
114-
}
115-
```
116-
</TabItem>
117-
118-
</Tabs>
119-
</Disclosure>
120-
````
121-
122-
1. #### `Hidden` component
123-
124-
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.
125-
126-
```jsx
127-
import { Hidden } from "@interledger/docs-design-system";
128-
```
129-
130-
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.
131-
132-
1. #### `LargeImg` component
133-
134-
Use this component if you have a diagram or image that is much larger than our available space and you would like users to view the full image in another tab. This adds a link to "View full image" with an external link indicator on the bottom right corner under the image. It takes in a `src` and `alt`, just like a normal `img` element.
135-
136-
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:
137-
138-
```jsx
139-
import { LargeImg } from "@interledger/docs-design-system";
140-
```
141-
142-
Use the `<LargeImg>` component within your content like so:
143-
144-
```jsx
145-
<LargeImg src="/img/OMG_A_GIGANTIC_IMG.png" alt="A really large diagram" />
146-
```
147-
148-
By default, there will be a border around the image, but if you want to remove the border, pass in a `hasBorder={false}` attribute.
149-
150-
```jsx
151-
<LargeImg
152-
src="/img/OMG_A_GIGANTIC_IMG.png"
153-
alt="A really large diagram"
154-
hasBorder={false}
155-
/>
156-
```
157-
158-
For user doc diagrams, be sure to include the `docs` folder in the path.
159-
160-
```jsx
161-
<LargeImg
162-
src="/img/docs/OMG_A_GIGANTIC_IMG.png"
163-
alt="A really large diagram"
164-
/>
165-
```
166-
167-
1. #### `LinkOut` component
168-
169-
Use this component if you need to add an external link to your content that opens in a new tab. This component adds the necessary attributes for external links and adds an external link indicator icon to the end of the link content. The icon can be turned off, if necessary.
170-
171-
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:
172-
173-
```jsx
174-
import { LinkOut } from "@interledger/docs-design-system";
175-
```
176-
177-
Use the `<LinkOut>` component within your content like so:
178-
179-
```jsx
180-
<LinkOut href="https://openpayments.guide/">OpenPayments API</LinkOut>
181-
```
182-
183-
If you do not want the external link icon to appear, you can set the `withIcon` prop to `false` like so:
184-
185-
```jsx
186-
<LinkOut href="https://openpayments.guide/" withIcon={false}>
187-
OpenPayments API
188-
</LinkOut>
189-
```
190-
191-
1. #### `MermaidWrapper` component
192-
193-
Starlight does not support Mermaid by default, so you would have to install [remark-mermaidjs](https://github.com/remcohaszing/remark-mermaidjs) on your Starlight site before you can use this component.
194-
195-
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.
196-
197-
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:
198-
199-
```jsx
200-
import { MermaidWrapper } from "@interledger/docs-design-system";
201-
```
202-
203-
Use the `<MermaidWrapper>` component within your content like so:
204-
205-
````jsx
206-
<MermaidWrapper client:load>
207-
```mermaid sequenceDiagram Alice ->> Bob: Hello Bob, how are you?
208-
Bob-->>John: How about you John? Bob--x Alice: I am good thanks! Bob-x
209-
John: I am good thanks! Note right of John: Bob thinks a long
210-
<br />
211-
long time, so long
212-
<br />
213-
that the text does
214-
<br />
215-
not fit on a row. Bob-->Alice: Checking with John... Alice->John: Yes...
216-
John, how are you? ```
217-
</MermaidWrapper>
218-
````
219-
220-
By default, there will be a border around the image, but if you want to remove the border, pass in a `hasBorder={false}` attribute.
221-
222-
````jsx
223-
<MermaidWrapper client:load hasBorder={false}>
224-
```mermaid sequenceDiagram Alice ->> Bob: Hello Bob, how are you?
225-
Bob-->>John: How about you John? Bob--x Alice: I am good thanks! Bob-x
226-
John: I am good thanks! Note right of John: Bob thinks a long
227-
<br />
228-
long time, so long
229-
<br />
230-
that the text does
231-
<br />
232-
not fit on a row. Bob-->Alice: Checking with John... Alice->John: Yes...
233-
John, how are you? ```
234-
</MermaidWrapper>
235-
````
236-
237-
1. #### `StylishHeader` component
238-
239-
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:
240-
241-
```jsx
242-
import { StylishHeader } from "@interledger/docs-design-system";
243-
```
244-
245-
Use the `<StylishHeader>` component within your content like so:
246-
247-
```jsx
248-
<StylishHeader>Wow I'm a stylish header</StylishHeader>
249-
```
250-
251-
1. #### `Tooltip` component
252-
253-
Use the tooltip component for adding a short explanation to specific terms. This component is built to be accessible in accordance to the guidance from [WAI Tooltip Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/). Note that the `client:load` attribute is required for the functionality to work because this component relies on state.
254-
255-
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:
256-
257-
```jsx
258-
import { Tooltip } from "@interledger/docs-design-system";
259-
```
55+
```bash
56+
git clone https://github.com/interledger/docs-design-system.git
57+
```
26058

261-
Use the `<Tooltip>` component within your content like so:
59+
```bash
60+
git clone https://github.com/interledger/docs-styleguide.git
61+
```
26262

263-
```jsx
264-
<Tooltip content='THIS CONTENT IS DISPLAYED IN THE TOOLTIP UPON INTERACTION' client:load><span>text that you are trying to explain</span></Tooltip>.
265-
```
63+
2. Make the documentation style guide read from the local version of the docs-design-system library by modifying the package.json. This will depend on the file structure of your local machine but it would look something like this:
26664

267-
If the text you are trying to explain is also a link to somewhere else, please put the link within the `<Tooltip>` like so:
65+
```json
66+
"dependencies": {
67+
"@interledger/docs-design-system": "../docs-design-system",
68+
}
69+
```
26870

269-
```jsx
270-
<Tooltip content='THIS CONTENT IS DISPLAYED IN THE TOOLTIP UPON INTERACTION' client:load><a href="/URL">text that you are trying to explain</a></Tooltip>.
271-
```
71+
3. After you're done with your changes and have tested that all is well, feel free to make a pull request and it will get reviewed, and hopefully merged into the source code. The version will get bumped and all the sites will have to make an update to their dependencies as well.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@interledger/docs-design-system",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"type": "module",
55
"description": "Shared styles and components used across all Interledger Starlight documentation sites",
66
"exports": {

src/styles/ilf-docs.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,25 @@
7474
}
7575

7676
/* Navigation sidebar styles */
77-
.sidebar-content .sidebar ul {
77+
.sidebar-content ul {
7878
--sl-sidebar-item-padding-inline: var(--space-s);
7979
}
8080

81-
.sidebar-content .sidebar li {
81+
.sidebar-content li {
8282
margin: 0;
8383
}
8484

85-
.sidebar-content .sidebar a {
85+
.sidebar-content a {
8686
padding: var(--space-2xs) var(--sl-sidebar-item-padding-inline);
8787
}
8888

89-
.sidebar-content .sidebar summary {
89+
.sidebar-content summary {
9090
padding: var(--space-2xs) var(--sl-sidebar-item-padding-inline);
9191
}
9292

93-
.sidebar-content .sidebar a[aria-current="page"],
94-
.sidebar-content .sidebar a[aria-current="page"]:hover,
95-
.sidebar-content .sidebar a[aria-current="page"]:focus {
93+
.sidebar-content a[aria-current="page"],
94+
.sidebar-content a[aria-current="page"]:hover,
95+
.sidebar-content a[aria-current="page"]:focus {
9696
color: var(--sl-color-text-accent);
9797
background-color: var(--sl-color-accent-low);
9898
border-radius: 0;
@@ -105,7 +105,7 @@
105105
z-index: 0;
106106
}
107107

108-
.sidebar-content .sidebar {
108+
.sidebar-content {
109109
padding: 0;
110110
}
111111
}

0 commit comments

Comments
 (0)