Skip to content

Commit 71bae0b

Browse files
authored
Merge pull request #6 from swan-io/DOC-1325/import-all-global-changes-dating-back-3-months-from-the-docs
Updating API reference to match Docs implementation
2 parents 780f57d + c025878 commit 71bae0b

File tree

5 files changed

+173
-16
lines changed

5 files changed

+173
-16
lines changed

docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This API reference includes:
1818

1919
### API Support
2020

21-
integration@swan.io
21+
Contact your Swan technical contact, or submit a ticket through your Dashboard.
2222

2323
### Sales team
2424

docusaurus.config.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,18 @@ module.exports = {
6161
{
6262
position: "right",
6363
href: "https://explorer.swan.io/",
64-
label: "API Explorer",
64+
label: "API Explorer",
65+
className: "swan-api-explorer"
6566
},
6667
{
67-
position: "right",
68-
href: "https://docs.swan.io/changelog",
69-
label: "Changelog",
70-
target: "_self",
71-
},
68+
type: "html",
69+
position: "right",
70+
value: `<div class="swan-unified-nav">
71+
<a href="https://docs.swan.io/changelog">Changelog</a>
72+
<div class="separator"></div>
73+
<a href="https://docs.swan.io/preview">Preview</a>
74+
</div>`
75+
}
7276
],
7377
},
7478
// footer: {
@@ -102,6 +106,9 @@ module.exports = {
102106
[
103107
"@docusaurus/preset-classic",
104108
{
109+
googleTagManager: {
110+
containerId: 'GTM-NWPK43X',
111+
},
105112
docs: {
106113
routeBasePath: "/",
107114
sidebarPath: require.resolve("./sidebars.js"),
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { useEffect } from "react";
2+
3+
export default function SidebarAutoScroll() {
4+
useEffect(() => {
5+
const activeLinks = document.querySelectorAll(".menu__link--active");
6+
// Take the last in selection, as every ancestor link is also marked as active
7+
const deepestActiveLink = activeLinks[activeLinks.length - 1];
8+
if (deepestActiveLink == null) {
9+
return;
10+
}
11+
const menu = deepestActiveLink.closest(".menu");
12+
13+
if (menu != null) {
14+
const activeLinkRect = deepestActiveLink.getBoundingClientRect();
15+
const menuRect = menu.getBoundingClientRect();
16+
menu.scrollTop =
17+
activeLinkRect.top - menuRect.height / 2 - activeLinkRect.height / 2;
18+
}
19+
}, []);
20+
21+
return null;
22+
}

src/css/custom.css

Lines changed: 126 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ body {
106106
}
107107

108108
.markdown h2 {
109-
font-size: 20px;
109+
font-size: 24px;
110110
font-weight: 600;
111111
}
112112

113113
.markdown h3 {
114114
font-size: 20px;
115-
font-weight: 400;
115+
font-weight: 600;
116116
}
117117

118118
.docusaurus-highlight-code-line {
@@ -130,10 +130,6 @@ pre {
130130
line-height: 1.7;
131131
}
132132

133-
/* .menu__list {
134-
transition: none !important;
135-
} */
136-
137133
.graphiql-container {
138134
flex-grow: 1;
139135
}
@@ -243,7 +239,128 @@ pre {
243239
}
244240
}
245241

246-
.navbar__link[href="https://docs.swan.io/changelog"] svg
247-
{
248-
display: none;
242+
.explorer-badge {
243+
display: inline-flex;
244+
align-items: center;
245+
background: #e9e0f2;
246+
border: 1px solid #c0b3e1;
247+
border-bottom: none;
248+
border-radius: 6px 6px 0 0;
249+
padding: 8px 32px 8px 16px;
250+
font-size: 14px;
251+
color: var(--ifm-color-primary);
252+
text-decoration: none;
253+
font-weight: 600;
254+
margin-left: 1rem;
255+
cursor: pointer;
256+
transition: all 0.2s ease;
257+
}
258+
259+
.explorer-badge:hover {
260+
background: var(--ifm-navbar-link-hover-color);
261+
color: white;
262+
text-decoration: none;
263+
border-color: var(--ifm-color-primary);
264+
}
265+
266+
.explorer-badge::before {
267+
content: "🔍";
268+
margin-right: 8px;
269+
}
270+
271+
.tabs-container {
272+
background: #fff;
273+
border-radius: 10px;
274+
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.04);
275+
margin: 24px 0;
276+
padding: 0 24px 24px 24px;
277+
border: 1px solid #edeff3;
249278
}
279+
280+
.tabs {
281+
background: #eff3f9;
282+
margin: 0 -24px;
283+
padding: 3px 3px 0;
284+
border-radius: 8px 8px 0 0;
285+
}
286+
287+
.tabs__item {
288+
padding: 0.75em 1.5em;
289+
}
290+
291+
.tabs__item--active {
292+
background: #fff;
293+
color: var(--ifm-color-primary);
294+
border-bottom: 2px solid var(--ifm-color-primary);
295+
font-weight: 600;
296+
}
297+
298+
html[data-theme="dark"] .tabs-container {
299+
background: #1e293b;
300+
border-bottom-color: #475569;
301+
}
302+
303+
html[data-theme="dark"] .tabs {
304+
background: #334155;
305+
}
306+
307+
html[data-theme="dark"] .tabs__item--active {
308+
background: #1e293b;
309+
}
310+
311+
.navbar__link.swan-api-explorer,
312+
.swan-unified-nav {
313+
padding: 0.5rem 1rem;
314+
background: #f1f5f9;
315+
border: 1px solid #cbd5e1;
316+
border-radius: 8px;
317+
font-weight: 500;
318+
transition: all 0.65s ease;
319+
}
320+
321+
.navbar__link.swan-api-explorer:hover,
322+
.swan-unified-nav:hover {
323+
background: none;
324+
border-color: #94a3b8;
325+
}
326+
327+
.swan-unified-nav {
328+
display: flex;
329+
align-items: center;
330+
padding: 0;
331+
overflow: hidden;
332+
}
333+
334+
.swan-unified-nav a {
335+
padding: 0.5rem 1rem;
336+
color: inherit;
337+
text-decoration: none;
338+
transition: background-color 0.2s;
339+
position: relative;
340+
}
341+
342+
.swan-unified-nav a::after {
343+
content: '';
344+
position: absolute;
345+
bottom: 0;
346+
left: 0;
347+
width: 100%;
348+
height: 2px;
349+
background: #94a3b8;
350+
transform: scaleX(0);
351+
transition: transform 0.2s ease;
352+
}
353+
354+
.swan-unified-nav a:hover {
355+
opacity: 0.8;
356+
}
357+
358+
.swan-unified-nav a:hover::after {
359+
transform: scaleX(1);
360+
}
361+
362+
.swan-unified-nav .separator {
363+
width: 1px;
364+
height: 20px;
365+
background: #cbd5e1;
366+
}

src/theme/Root.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import SidebarAutoScroll from '../components/SidebarAutoScroll';
3+
4+
export default function Root({ children }) {
5+
return (
6+
<>
7+
{children}
8+
<SidebarAutoScroll />
9+
</>
10+
);
11+
}

0 commit comments

Comments
 (0)