@rcsb/rcsb-documentation 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@rcsb/rcsb-documentation",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "main": "src/index.js",
6
+ "files": [
7
+ "build"
8
+ ],
9
+ "dependencies": {
10
+ "react": "^18.3.1",
11
+ "react-dom": "^18.3.1",
12
+ "react-router-dom": "^6.25.1",
13
+ "react-scripts": "^5.0.1"
14
+ },
15
+ "scripts": {
16
+ "start": "react-scripts start",
17
+ "build": "react-scripts build",
18
+ "prepublishOnly": "npm run build",
19
+ "test": "react-scripts test",
20
+ "eject": "react-scripts eject"
21
+ },
22
+ "eslintConfig": {
23
+ "extends": [
24
+ "react-app",
25
+ "react-app/jest"
26
+ ]
27
+ },
28
+ "browserslist": {
29
+ "production": [
30
+ ">0.2%",
31
+ "not dead",
32
+ "not op_mini all"
33
+ ],
34
+ "development": [
35
+ "last 1 chrome version",
36
+ "last 1 firefox version",
37
+ "last 1 safari version"
38
+ ]
39
+ },
40
+ "devDependencies": {
41
+ "@babel/plugin-transform-modules-commonjs": "^7.24.7",
42
+ "css-loader": "^7.1.2",
43
+ "react-app-rewired": "^2.2.1",
44
+ "style-loader": "^4.0.0",
45
+ "webpack-cli": "^5.1.4"
46
+ }
47
+ }
package/src/index.js ADDED
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
4
+ import routes from './routes';
5
+ import ErrorBoundary from './components/ErrorBoundary';
6
+
7
+ const NotFound = () => (
8
+ <div>
9
+ Oops, looks like this page is not exist. Try going back to the homepage.
10
+ </div>
11
+ );
12
+
13
+ const AppContent = () => {
14
+ return (
15
+ <main className="doc-container mt-5">
16
+ <Routes>
17
+ {routes.map((route, index) => (
18
+ <Route
19
+ key={index}
20
+ path={route.path}
21
+ element={route.element}
22
+ />
23
+ ))}
24
+ <Route path="*" element={<NotFound />} />
25
+ </Routes>
26
+ </main>
27
+ );
28
+ };
29
+
30
+ //Set the global variable for basename
31
+ const basename =window.__DOCUMENTATION_BASEROUTE__ || '';
32
+ const App = () => {
33
+ return (
34
+ <ErrorBoundary>
35
+ <Router basename={basename}>
36
+ <AppContent />
37
+ </Router>
38
+ </ErrorBoundary>
39
+ );
40
+ };
41
+
42
+ const root = ReactDOM.createRoot(document.getElementById('root'));
43
+ root.render(
44
+ <React.StrictMode>
45
+ <App basename={basename} />
46
+ </React.StrictMode>
47
+ );
48
+