Skip to content

Commit 6295110

Browse files
add: custom navigation added (#9)
* add: custom navigation added * add: github workflow added * add: github workflow added * update: docs yaml, and preview workflow * fix: preview workflow * fix: header footer data fething * fix: msc bump * add: github auth token added * fix: auth token * fix: github workflow * fix: github workflow * rerun workflow * remove: npm rc * fix: github workflow * fix: github workflow v2 * fix: github workflow v3 * fix: github workflow v4 * fix: github workflow v5 * fix: fetch call * fix: header and footer cjs added * fix: header and footer cjs added * fix: header data rendering * fix: header data rendering * fix: header data rendering * fix: header data rendering * fix: header data rendering * add: comment asyn data call * fix: page data sanity fix * fix: page data sanity fix * fix: page data sanity fix * header fix * header fix * fix: workflows * bump: msc version * fix: workflows * fix: workflows * fix: workflows * fix: update header * fix: update header * fix: update header * add: plug script * add: plug script * add: plug script * add: plug script * add: plug script * add: plug script * remove: plug script * remove: plug script * remove: plug script * remove: plug script * remove: plug script * remove: plug script * remove: plug script * fix: css problem * fix: css problem * fix: css problem * fix: css problem * fix: footer css * fix: sidenav sibling * fix: sidenav sibling * fix: sidenav sibling * fix: sidenav sibling seperated * fix: sidenav sibling seperated v2 * fix: sidenav sibling seperated v3 * fix: sidenav sibling seperated v3 * fix: sidenav sibling seperated v4 * fix: sidenav sibling seperated v5 * add: api toggles * add: api toggles * add: api toggles v2 * fix: build * add: fern styles * fix: rendering * fix: rendering * fix: rendering v2 * fix: styles on dropdown * fix: dropdown border * fix: theme switch * fix: theme switch * revert: to stable build * fix: code fixes * revert: to stable build
1 parent c029f20 commit 6295110

29 files changed

+9035
-20
lines changed

.github/workflows/preview-docs.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ jobs:
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v4
1818
with:
19-
node-version: "18"
19+
always-auth: true
20+
node-version: '18'
21+
registry-url: https://npm.pkg.github.com/
22+
env:
23+
NODE_AUTH_TOKEN: ${{secrets.AUTH_TOKEN}}
2024

2125
- name: Install Fern
2226
run: npm install -g fern-api
2327

28+
- name: Build Navigation
29+
run: |
30+
cd custom-implementation
31+
yarn
32+
yarn build
33+
cd ../
34+
35+
2436
- name: Generate Documentation Preview with Fern
2537
id: generate_docs
2638
env:

.github/workflows/publish-docs.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name: ci
22

3-
on:
4-
push:
5-
branches:
6-
- main
3+
on:
4+
push:
5+
branches:
6+
- main
77

88
jobs:
99
publish-docs:
1010
runs-on: ubuntu-latest
11+
1112
steps:
1213
- name: Checkout repo
1314
uses: actions/checkout@v4
@@ -21,4 +22,4 @@ jobs:
2122
- name: Generate and Publish Docs
2223
env:
2324
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
24-
run: fern generate --docs
25+
run: fern generate --docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
node_modules
12
fern/*/definition/
23
.DS_Store
34
.idea

custom-implementation/.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
node_modules/*
7+
yarn.lock
8+
tailwind.config.js

custom-implementation/.eslintrc.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
plugins: ['react-refresh'],
12+
rules: {
13+
'react-refresh/only-export-components': [
14+
'warn',
15+
{ allowConstantExport: true },
16+
],
17+
},
18+
}

custom-implementation/.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
node_modules/*
7+
yarn.lock

custom-implementation/.prettierrc.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
semi: false,
3+
trailingComma: 'all',
4+
singleQuote: true,
5+
printWidth: 80,
6+
tabWidth: 2,
7+
jsxBracketSameLine: true,
8+
endOfLine: 'auto',
9+
}

custom-implementation/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
</head>
5+
<body>
6+
<header id="fern-header"></header>
7+
<footer id="fern-footer" style="margin-top:100px"></footer>
8+
<script type="module" src="/src/main.tsx"></script>
9+
</body>
10+
</html>

custom-implementation/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "custom-app",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10+
"preview": "vite preview"
11+
},
12+
"dependencies": {
13+
"@devrev/marketing-shared-components": "^0.3.16",
14+
"@radix-ui/react-dropdown-menu": "^2.0.6",
15+
"@sanity/client": "^6.15.3",
16+
"react": "^18.2.0",
17+
"react-dom": "^18.2.0"
18+
},
19+
"devDependencies": {
20+
"@types/react": "^18.2.55",
21+
"@types/react-dom": "^18.2.19",
22+
"@typescript-eslint/eslint-plugin": "^6.21.0",
23+
"@typescript-eslint/parser": "^6.21.0",
24+
"@vitejs/plugin-react": "^4.2.1",
25+
"eslint": "^8.56.0",
26+
"eslint-plugin-react-hooks": "^4.6.0",
27+
"eslint-plugin-react-refresh": "^0.4.5",
28+
"typescript": "^5.2.2",
29+
"vite": "^5.1.0"
30+
}
31+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.footer a {
2+
text-decoration: none;
3+
color: black;
4+
cursor: pointer;
5+
}
6+
7+
.footer html, body, div, applet, object, iframe,
8+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
9+
a, abbr, acronym, address, big, cite, code,
10+
del, dfn, em, img, ins, kbd, q, s, samp,
11+
small, strike, strong, sub, sup, tt, var,
12+
b, u, i, center,
13+
dl, dt, dd, ol, ul, li,
14+
fieldset, form, label, legend,
15+
table, caption, tbody, tfoot, thead, tr, th, td,
16+
article, aside, canvas, details, embed,
17+
figure, figcaption, footer, header, hgroup,
18+
menu, nav, output, ruby, section, summary,
19+
time, mark, audio, video, button {
20+
margin: 0;
21+
padding: 0;
22+
border: 0;
23+
font-size: 100%;
24+
font: inherit;
25+
vertical-align: baseline;
26+
line-height: 19px;
27+
}
28+
29+
30+
/* HTML5 display-role reset for older browsers */
31+
.footer article, aside, details, figcaption, figure,
32+
footer, header, hgroup, menu, nav, section {
33+
display: block;
34+
}
35+
36+
.footer ol, ul {
37+
list-style: none;
38+
}
39+
40+
.footer blockquote, q {
41+
quotes: none;
42+
}
43+
44+
.footer blockquote:before, blockquote:after, q:before, q:after {
45+
content: '';
46+
content: none;
47+
}
48+
49+
.footer table {
50+
border-collapse: collapse;
51+
border-spacing: 0;
52+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use client'
2+
3+
import {
4+
ComponentConfigContext,
5+
FooterV30 as SharedFooter,
6+
} from '@devrev/marketing-shared-components/dist/cjs'
7+
8+
import './footer.css'
9+
10+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11+
const Footer = ({ list = [], logo, status, compliance, ...rest }: any) => {
12+
// Footer
13+
return (
14+
<ComponentConfigContext.Provider
15+
value={{
16+
origin: 'https://api.docs.devrev.ai',
17+
}}>
18+
<SharedFooter
19+
className="footer"
20+
list={list}
21+
logo={logo}
22+
status={status}
23+
compliance={compliance}
24+
{...rest}
25+
/>
26+
</ComponentConfigContext.Provider>
27+
)
28+
}
29+
30+
export default Footer
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.header {
2+
background-color: white;
3+
}
4+
5+
.header nav a {
6+
text-decoration: none;
7+
color: black;
8+
cursor: pointer;
9+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use client'
2+
3+
import {
4+
ComponentConfigContext,
5+
HeaderV30 as SharedHeader,
6+
} from '@devrev/marketing-shared-components/dist/cjs'
7+
8+
import './header.css'
9+
10+
const Header = ({
11+
logo,
12+
links,
13+
actions,
14+
version,
15+
collapseOnScroll = true,
16+
}: // eslint-disable-next-line @typescript-eslint/no-explicit-any
17+
any) => {
18+
return (
19+
<div>
20+
<ComponentConfigContext.Provider
21+
value={{
22+
origin: 'https://api.docs.devrev.ai',
23+
}}>
24+
<SharedHeader
25+
logo={logo}
26+
items={links}
27+
actions={actions}
28+
version={version}
29+
collapseOnScroll={collapseOnScroll}
30+
wrapperClassName="header"
31+
/>
32+
</ComponentConfigContext.Provider>
33+
</div>
34+
)
35+
}
36+
37+
export default Header
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import React, { useEffect } from 'react'
2+
3+
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
4+
5+
export const ThemeSwitch = () => {
6+
const [selected, setSelected] = React.useState('public')
7+
8+
useEffect(() => {
9+
const beta = window.location.pathname.split('/').includes('beta')
10+
setSelected(beta ? 'beta' : 'public')
11+
}, [])
12+
13+
return (
14+
<div className="mt-2">
15+
<DropdownMenu.Root>
16+
<DropdownMenu.Trigger asChild>
17+
<button
18+
className="fern-button outlined normal primary"
19+
style={{
20+
width: '100%',
21+
}}>
22+
<span
23+
className="fern-button-content"
24+
style={{
25+
width: '100%',
26+
justifyContent: 'space-between',
27+
}}>
28+
<span className="fern-button-text">
29+
{selected === 'beta' ? 'Beta' : 'Public'}
30+
</span>
31+
<svg
32+
width="15"
33+
height="15"
34+
viewBox="0 0 15 15"
35+
fill="none"
36+
xmlns="http://www.w3.org/2000/svg"
37+
className="transition-transform data-[state=open]:rotate-180">
38+
<path
39+
d="M4.18179 6.18181C4.35753 6.00608 4.64245 6.00608 4.81819 6.18181L7.49999 8.86362L10.1818 6.18181C10.3575 6.00608 10.6424 6.00608 10.8182 6.18181C10.9939 6.35755 10.9939 6.64247 10.8182 6.81821L7.81819 9.81821C7.73379 9.9026 7.61934 9.95001 7.49999 9.95001C7.38064 9.95001 7.26618 9.9026 7.18179 9.81821L4.18179 6.81821C4.00605 6.64247 4.00605 6.35755 4.18179 6.18181Z"
40+
fill="currentColor"
41+
fill-rule="evenodd"
42+
clip-rule="evenodd"
43+
/>
44+
</svg>
45+
</span>
46+
</button>
47+
</DropdownMenu.Trigger>
48+
49+
<DropdownMenu.Portal>
50+
<DropdownMenu.Content
51+
className="fern-dropdown"
52+
style={{
53+
marginTop: '4px',
54+
border: 'rgba(93, 101, 238, 0.4) 1px solid',
55+
}}>
56+
<DropdownMenu.RadioGroup
57+
value={selected}
58+
onValueChange={setSelected}>
59+
<DropdownMenu.RadioItem value="public">
60+
<a className="fern-dropdown-item" href="/about/for-developers">
61+
<span
62+
style={{
63+
marginRight: 'auto',
64+
}}>
65+
<span>Public</span>
66+
</span>
67+
<DropdownMenu.ItemIndicator className="fern-dropdown-item-indicator">
68+
<svg
69+
width="15"
70+
height="15"
71+
viewBox="0 0 15 15"
72+
fill="none"
73+
xmlns="http://www.w3.org/2000/svg">
74+
<path
75+
d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z"
76+
fill="currentColor"
77+
fill-rule="evenodd"
78+
clip-rule="evenodd"></path>
79+
</svg>
80+
</DropdownMenu.ItemIndicator>
81+
</a>
82+
</DropdownMenu.RadioItem>
83+
<DropdownMenu.RadioItem value="beta">
84+
<a
85+
className="fern-dropdown-item"
86+
style={{
87+
justifyContent: 'space-between',
88+
}}
89+
href="/beta/about/for-developers">
90+
<span
91+
style={{
92+
marginRight: 'auto',
93+
}}>
94+
<span>Beta</span>
95+
</span>
96+
<DropdownMenu.ItemIndicator className="fern-dropdown-item-indicator">
97+
<svg
98+
width="15"
99+
height="15"
100+
viewBox="0 0 15 15"
101+
fill="none"
102+
xmlns="http://www.w3.org/2000/svg">
103+
<path
104+
d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z"
105+
fill="currentColor"
106+
fill-rule="evenodd"
107+
clip-rule="evenodd"></path>
108+
</svg>
109+
</DropdownMenu.ItemIndicator>
110+
</a>
111+
</DropdownMenu.RadioItem>
112+
</DropdownMenu.RadioGroup>
113+
</DropdownMenu.Content>
114+
</DropdownMenu.Portal>
115+
</DropdownMenu.Root>
116+
</div>
117+
)
118+
}

0 commit comments

Comments
 (0)