Skip to content

Commit 57a6085

Browse files
authored
Interact revamp docs app (#26)
* Regenerate docs app to use the docs in interact/docs package * Fixed links in content to do proper navigation * Renamed rules * update yarn.lock * Add a /rules route to the docs app the exposes the rules files as raw markdown * Fixed issues from reviews * Update and fix Interact root README * Created new workflow interactdocs
1 parent e0a4167 commit 57a6085

27 files changed

Lines changed: 3829 additions & 492 deletions

.github/workflows/interactdocs.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
26+
with:
27+
node-version: 24
28+
29+
- name: Enable Corepack
30+
run: corepack enable
31+
run: corepack prepare yarn@4.10.3 --activate
32+
run: yarn set version 4.10.3
33+
run: NPQ_PKG_MGR=yarn npx npq install
34+
35+
- name: Build interact package
36+
run: yarn workspace @wix/interact build
37+
38+
- name: Build docs app
39+
run: yarn workspace @wix/interact-docs build
40+
env:
41+
# Set base path for GitHub Pages deployment under /docs
42+
VITE_BASE: /docs/
43+
44+
- name: Prepare deployment directory
45+
run: |
46+
mkdir -p _site/docs
47+
cp -r apps/docs/dist/* _site/docs/
48+
49+
- name: Setup Pages
50+
uses: actions/configure-pages@6509e525a06f43847064050610066357391e6390 # v5
51+
52+
- name: Upload artifact
53+
uses: actions/upload-pages-artifact@3a27866f6480871542049080632d70930d695383 # v3
54+
with:
55+
path: _site
56+
57+
deploy:
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}docs/
61+
runs-on: ubuntu-latest
62+
needs: build
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@939173330191535487491557568637540315448 # v4

apps/docs/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build": "tsc && vite build && node scripts/copy-docs.js",
99
"preview": "vite preview",
1010
"lint": "tsc --noEmit",
1111
"test": "echo 'No tests yet'"
1212
},
1313
"dependencies": {
1414
"@wix/interact": "*",
1515
"react": "^18.3.1",
16-
"react-dom": "^18.3.1"
16+
"react-dom": "^18.3.1",
17+
"react-markdown": "^9.0.1",
18+
"react-router-dom": "^7.1.1",
19+
"rehype-highlight": "^7.0.1",
20+
"remark-gfm": "^4.0.0"
1721
},
1822
"devDependencies": {
1923
"@types/react": "^18.3.2",

apps/docs/scripts/copy-docs.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cpSync, mkdirSync, existsSync } from 'node:fs';
2+
import { resolve, dirname } from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const srcDocs = resolve(__dirname, '../../../packages/interact/docs');
9+
const destDocs = resolve(__dirname, '../dist/docs');
10+
11+
const srcRules = resolve(__dirname, '../../../packages/interact/rules');
12+
const destRules = resolve(__dirname, '../dist/rules');
13+
14+
// Create dest directory if it doesn't exist
15+
if (!existsSync(dirname(destDocs))) {
16+
mkdirSync(dirname(destDocs), { recursive: true });
17+
}
18+
19+
// Copy docs to dist
20+
cpSync(srcDocs, destDocs, { recursive: true, force: true });
21+
22+
console.log('✓ Docs copied to dist/docs');
23+
24+
// Copy rules to dist
25+
cpSync(srcRules, destRules, { recursive: true, force: true });
26+
27+
console.log('✓ Rules copied to dist/rules');
28+

apps/docs/src/App.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
12
import { Layout } from './components/Layout';
2-
import { Introduction } from './pages/Introduction';
3-
import { ComponentExamples } from './pages/ComponentExamples';
4-
import { ApiCheatsheet } from './pages/ApiCheatsheet';
3+
import { MarkdownPage } from './components/MarkdownPage';
54

65
function App() {
76
return (
8-
<Layout>
9-
<Introduction />
10-
<ComponentExamples />
11-
<ApiCheatsheet />
12-
</Layout>
7+
<BrowserRouter>
8+
<Layout>
9+
<Routes>
10+
<Route path="*" element={<MarkdownPage />} />
11+
</Routes>
12+
</Layout>
13+
</BrowserRouter>
1314
);
1415
}
1516

1617
export default App;
17-

apps/docs/src/components/InteractShowcase.tsx

Lines changed: 0 additions & 123 deletions
This file was deleted.
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import type { PropsWithChildren } from 'react';
2-
import { DocsSidebar } from './Sidebar';
2+
import { Sidebar } from './Sidebar';
33

4-
export const Layout = ({ children }: PropsWithChildren) => {
4+
export function Layout({ children }: PropsWithChildren) {
55
return (
6-
<div className="docs-layout">
7-
<DocsSidebar />
8-
<main className="docs-content">{children}</main>
6+
<div className="layout">
7+
<Sidebar />
8+
<main className="main-content">
9+
<div className="content-container">
10+
{children}
11+
</div>
12+
</main>
913
</div>
1014
);
11-
};
12-
15+
}

0 commit comments

Comments
 (0)