Link fixes for basePath
This commit is contained in:
parent
ed842bdc78
commit
b0f4cc2781
6 changed files with 20 additions and 10 deletions
10
client/components/Link.tsx
Normal file
10
client/components/Link.tsx
Normal 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
|
|
@ -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();
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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 })
|
||||
|
|
Loading…
Reference in a new issue