Link fixes for basePath

This commit is contained in:
Max Leiter 2022-03-06 17:20:01 -08:00
parent ed842bdc78
commit b0f4cc2781
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A3512F2F2F17EBDA
6 changed files with 20 additions and 10 deletions

View file

@ -0,0 +1,10 @@
import { Link as GeistLink, LinkProps } from "@geist-ui/core"
import { useRouter } from "next/router";
const Link = (props: LinkProps) => {
const { basePath } = useRouter();
return <GeistLink {...props} href={`/${basePath}/${props.href}`} />
}
export default Link

View file

@ -1,7 +1,8 @@
import { FormEvent, useState } from 'react'
import { Button, Card, Input, Link, Text } from '@geist-ui/core'
import { Button, Card, Input, Text } from '@geist-ui/core'
import styles from './auth.module.css'
import { useRouter } from 'next/router'
import Link from '../Link'
const Auth = ({ page }: { page: "signup" | "signin" }) => {
const router = useRouter();

View file

@ -1,9 +1,8 @@
import { Page, ButtonGroup, Button, Link } from "@geist-ui/core";
import { Page, ButtonGroup, Button } from "@geist-ui/core";
import { Moon, Sun } from "@geist-ui/icons";
import { useRouter } from "next/router";
import useSignedIn from "../../lib/hooks/use-signed-in";
import { DriftProps } from "../../pages/_app";
import ShiftBy from "../shift-by";
import Link from '../Link'
const Header = ({ theme, changeTheme }: DriftProps) => {
return (

View file

@ -1,7 +1,8 @@
import { Loading, Card, Divider, Input, Text, Link } from "@geist-ui/core"
import { Loading, Card, Divider, Input, Text } from "@geist-ui/core"
import Preview from "../preview"
import ShiftBy from "../shift-by"
import VisibilityBadge from "../visibility-badge"
import Link from '../Link'
import styles from './post-list.module.css'

View file

@ -1,7 +1,8 @@
import { Page, ButtonGroup, Button, Link } from "@geist-ui/core";
import { Page, ButtonGroup, Button } from "@geist-ui/core";
import { Moon, Sun } from "@geist-ui/icons";
import { DriftProps } from "../../pages/_app";
import ShiftBy from "../shift-by";
import Link from '../Link'
const UnauthenticatedHeader = ({ theme, changeTheme }: DriftProps) => {
return (

View file

@ -1,13 +1,11 @@
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import HomeComponent from '../components/post'
import Auth from '../components/auth'
import { useEffect, useState } from 'react'
import { Button, ButtonGroup, Link, Loading, Page } from '@geist-ui/core'
import { Button, ButtonGroup, Loading, Page } from '@geist-ui/core'
import { Sun, Moon } from '@geist-ui/icons'
import ShiftBy from '../components/shift-by'
import useSignedIn from '../lib/hooks/use-signed-in'
import { useRouter } from 'next/router'
import Link from '../components/Link'
const Home = ({ theme, changeTheme }: { theme: "light" | "dark", changeTheme: () => void }) => {
const { isLoading, isSignedIn } = useSignedIn({ redirectIfNotAuthed: true })