Commit 67b3f894 authored by René Rösner's avatar René Rösner
Browse files

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

parent 1449c479
import Document, { Html, Head, Main, NextScript } from 'next/document'
class CustomizedDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
......
import Link from 'next/link'
import useBasePath from "../shared/use-base-path";
export default () => {
const basePath = useBasePath();
return (
<div className="relative bg-white overflow-hidden">
<section className="relative pt-6 pb-6 sm:pb-12 lg:pb-16">
......@@ -28,7 +31,7 @@ export default () => {
</div>
<div className="mt-12 relative sm:max-w-md sm:mx-auto lg:mt-0 lg:max-w-none lg:mx-0 lg:col-span-4 lg:flex lg:items-center">
<div className="relative mx-auto w-full lg:max-w-md">
<img src={`${process.env.NEXT_PUBLIC_BASE_PATH ? process.env.NEXT_PUBLIC_BASE_PATH : ''}/img/kabelmaennchen_construct.svg`} alt={'Kabelmaennchen_Construct'}/>
<img src={`${basePath}/img/kabelmaennchen_construct.svg`} alt={'Kabelmaennchen_Construct'}/>
</div>
</div>
</div>
......
import useBasePath from "../shared/use-base-path";
export default () => {
const basePath = useBasePath();
return (
<div className="bg-white bg-opacity-25">
<div className="max-w-7xl mx-auto py-12 sm:px-6 lg:px-8">
......@@ -11,14 +14,14 @@ export default () => {
<div className="mt-4 ml-8 flex flex-grow flex-shrink-0 justify-center lg:flex-grow-0 lg:ml-4 items-center">
<img
className="h-12"
src={`${process.env.NEXT_PUBLIC_BASE_PATH ? process.env.NEXT_PUBLIC_BASE_PATH : ''}/img/it-planungsrat-logo.svg`}
src={`${basePath}/img/it-planungsrat-logo.svg`}
alt="IT Planungsrat"
/>
</div>
<div className="mt-4 ml-8 flex flex-grow flex-shrink-0 justify-center lg:flex-grow-0 lg:ml-4">
<img
className="h-28"
src={`${process.env.NEXT_PUBLIC_BASE_PATH ? process.env.NEXT_PUBLIC_BASE_PATH : ''}/img/fitko-main-logo.svg`}
src={`${basePath}/img/fitko-main-logo.svg`}
alt="FITKO"
/>
</div>
......
import React, {ReactElement} from 'react'
import Link from 'next/link'
import { useBasePath } from "../../shared/use-base-path";
import useBasePath from "../../shared/use-base-path";
export type FooterOptions = {
copyright: string
......@@ -22,7 +22,6 @@ export type FooterColumnOptions = {
}
export function FooterColumn({ title, links }: FooterColumnOptions) {
const basePath = useBasePath();
return (
<>
......@@ -47,6 +46,7 @@ export function FooterColumn({ title, links }: FooterColumnOptions) {
}
export function Footer({ logo, copyright, children }: FooterOptions) {
const basePath = useBasePath();
return (
<footer className="bg-white" aria-labelledby="footer-heading">
<h2 id="footer-heading" className="sr-only">
......
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