commit 9c7f9cc0750a5dd0c3d1ec9b225e0410fb3f9aa5
parent 5b290b9454450fecd4bddd7c8084273ac7bf4b85
Author: Agastya Chandrakant <me@hanabi.in>
Date: Tue, 19 May 2020 05:33:12 +0530
path hack for making this work
Diffstat:
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/App.js b/src/App.js
@@ -9,6 +9,7 @@ import Header from './comp/header';
import Help from './comp/help';
function App() {
+ const basePath = process.env.PUBLIC_URL;
return (
<Router>
<div
@@ -21,10 +22,10 @@ function App() {
>
<Header />
<Switch>
- <Route component={Help} path="/help" />
- <Route component={FromToTime} path="/from-to" />
- <Route component={Future} path="/future" />
- <Route component={CurrentTime} path="/" />
+ <Route component={Help} path={`${basePath}/help`} />
+ <Route component={FromToTime} path={`${basePath}/from-to`} />
+ <Route component={Future} path={`${basePath}/future`} />
+ <Route component={CurrentTime} path={`${basePath}/`} />
</Switch>
<Footer />
</div>
diff --git a/src/comp/header.js b/src/comp/header.js
@@ -2,9 +2,10 @@ import React from 'react';
import { Link } from 'react-router-dom';
function Header() {
+ const basePath = process.env.PUBLIC_URL;
return (
<nav className="navbar navbar-expand-lg navbar-dark bg-danger mb-4">
- <Link className="navbar-brand" to="/">
+ <Link className="navbar-brand" to={`${basePath}/`}>
<span role="img" aria-label="time convertor">
{new Date().getSeconds() % 2 ? '⏳' : '⌛️'}
</span>{' '}
@@ -24,17 +25,17 @@ function Header() {
<div className="collapse navbar-collapse" id="navbarNav">
<ul className="navbar-nav">
<li className="nav-item">
- <Link className="nav-link" to="/help">
+ <Link className="nav-link" to={`${basePath}/help`}>
Help
</Link>
</li>
<li className="nav-item">
- <Link className="nav-link" to="/future">
+ <Link className="nav-link" to={`${basePath}/future`}>
Future
</Link>
</li>
<li className="nav-item">
- <Link className="nav-link" to="/from-to">
+ <Link className="nav-link" to={`${basePath}/from-to`}>
From-to
</Link>
</li>
diff --git a/src/comp/help.js b/src/comp/help.js
@@ -3,6 +3,7 @@ import { Link } from 'react-router-dom';
import moment from 'moment-timezone';
function Help() {
+ const basePath = process.env.PUBLIC_URL;
const tz = moment.tz.guess();
const tzAbbr = moment.tz.zone(tz).abbr(moment());
return (
@@ -11,7 +12,7 @@ function Help() {
<li>
Use the{' '}
<Link
- to="/"
+ to={`${basePath}/`}
style={{
background: 'lavender',
borderRadius: '5px',
@@ -26,7 +27,7 @@ function Help() {
<li>
Use the{' '}
<Link
- to="/future"
+ to={`${basePath}/future`}
style={{
background: 'lavender',
borderRadius: '5px',
@@ -41,7 +42,7 @@ function Help() {
<li>
Use the{' '}
<Link
- to="/from-to"
+ to={`${basePath}/from-to`}
style={{
background: 'lavender',
borderRadius: '5px',