Commit 1449c479 authored by René Rösner's avatar René Rösner
Browse files

WIP: Basepath hook to have basepath maintainable again (planning#428)

parent 8a1dd19d
import { useState, useEffect } from "react";
export default function useBasePath() {
const [basePath, setBasePath] = useState('');
useEffect( () => {
setBasePath(process.env.NEXT_PUBLIC_BASE_PATH ? process.env.NEXT_PUBLIC_BASE_PATH : '');
}, [])
return basePath;
}
\ No newline at end of file
import React, {ReactElement} from 'react'
import Link from 'next/link'
import { JSXElement } from '@babel/types'
import { useBasePath } from "../../shared/use-base-path";
export type FooterOptions = {
copyright: string
......@@ -22,6 +22,8 @@ export type FooterColumnOptions = {
}
export function FooterColumn({ title, links }: FooterColumnOptions) {
const basePath = useBasePath();
return (
<>
<div>
......@@ -56,7 +58,7 @@ export function Footer({ logo, copyright, children }: FooterOptions) {
<Link href='/'>
<img
className="h-20 w-auto hover:cursor-pointer"
src={`${process.env.NEXT_PUBLIC_BASE_PATH ? process.env.NEXT_PUBLIC_BASE_PATH : ''}${logo.img}`}
src={`${basePath}${logo.img}`}
alt={logo.alt ? logo.alt : 'Logo'}
/>
</Link>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment