Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_URL=https://visual-framework.github.io/vf-react
5 changes: 4 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
CI: true
PUBLIC_URL: /vf-react

jobs:
# test:
Expand Down Expand Up @@ -44,8 +45,10 @@ jobs:
run: yarn install
- name: Build page
run: yarn build
env:
PUBLIC_URL: /vf-react
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY_150525 }}
publish_dir: ./build
publish_dir: ./build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
build
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "vf-react",
"version": "0.1.0",
"private": true,
"homepage": "https://visual-framework.github.io/vf-react/",
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
Expand Down
24 changes: 24 additions & 0 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Visual Framework React</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
var pathSegmentsToKeep = 1;

var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);
</script>
</head>
<body>
</body>
</html>
22 changes: 20 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,25 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/">
<base href="%PUBLIC_URL%/">

<!-- GitHub Pages SPA redirect script -->
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
(function(l) {
if (l.search[1] === '/' ) {
var decoded = l.search.slice(1).split('&').map(function(s) {
return s.replace(/~and~/g, '&')
}).join('?');
window.history.replaceState(null, null,
l.pathname.slice(0, -1) + decoded + l.hash
);
}
}(window.location))
</script>

<link rel="stylesheet" media="all" href="https://dev.assets.emblstatic.net/vf/develop/css/styles.css"/>
<!--
Want to build a site with the Visual Framework?
Expand Down Expand Up @@ -43,4 +61,4 @@
</head>
<body class="vf-body | vf-stack embl-content-hub-loaded">
</body>
</html>
</html>
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
import { BrowserRouter as Router, Routes, Route, useLocation } from 'react-router-dom';
import { HashRouter as Router, Routes, Route, useLocation } from 'react-router-dom';
import Header from './components/Header';
import Footer from './components/Footer';
import Home from './components/Home';
Expand Down Expand Up @@ -31,6 +31,7 @@ function RouteChangeHandler({ children }) {
}

function App() {
// Use HashRouter instead of BrowserRouter for GitHub Pages
return (
<Router>
<RouteChangeHandler>
Expand Down
2,110 changes: 1,198 additions & 912 deletions yarn.lock

Large diffs are not rendered by default.