mirror of
https://github.com/theoludwig/theoludwig.git
synced 2025-05-29 22:37:44 +02:00
fix: calculate age client side so it updates "automatically" (not only on rebuild)
This commit is contained in:
@ -5,20 +5,16 @@ import { ErrorPage } from 'components/ErrorPage'
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { getDefaultDescription } from 'utils/getDefaultDescription'
|
||||
import { DIVLO_BIRTHDAY, getAge } from 'utils/getAge'
|
||||
|
||||
interface Error404Props extends FooterProps {
|
||||
description: string
|
||||
}
|
||||
interface Error404Props extends FooterProps {}
|
||||
|
||||
const Error404: NextPage<Error404Props> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
const { version, description } = props
|
||||
const { version } = props
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title='404 | Divlo' description={description} />
|
||||
<Head title='404 | Divlo' />
|
||||
|
||||
<Header showLanguage />
|
||||
<main className='flex flex-col md:mx-auto md:max-w-4xl lg:max-w-7xl'>
|
||||
@ -29,12 +25,10 @@ const Error404: NextPage<Error404Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps<FooterProps> = async () => {
|
||||
export const getStaticProps: GetStaticProps<Error404Props> = async () => {
|
||||
const { readPackage } = await import('read-pkg')
|
||||
const { version } = await readPackage()
|
||||
const age = getAge(DIVLO_BIRTHDAY)
|
||||
const description = getDefaultDescription(age)
|
||||
return { props: { version, description } }
|
||||
return { props: { version } }
|
||||
}
|
||||
|
||||
export default Error404
|
||||
|
@ -5,20 +5,16 @@ import { ErrorPage } from 'components/ErrorPage'
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { getDefaultDescription } from 'utils/getDefaultDescription'
|
||||
import { DIVLO_BIRTHDAY, getAge } from 'utils/getAge'
|
||||
|
||||
interface Error500Props extends FooterProps {
|
||||
description: string
|
||||
}
|
||||
interface Error500Props extends FooterProps {}
|
||||
|
||||
const Error500: NextPage<Error500Props> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
const { version, description } = props
|
||||
const { version } = props
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title='500 | Divlo' description={description} />
|
||||
<Head title='500 | Divlo' />
|
||||
|
||||
<Header showLanguage />
|
||||
<main className='flex flex-col md:mx-auto md:max-w-4xl lg:max-w-7xl'>
|
||||
@ -29,12 +25,10 @@ const Error500: NextPage<Error500Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps<FooterProps> = async () => {
|
||||
export const getStaticProps: GetStaticProps<Error500Props> = async () => {
|
||||
const { readPackage } = await import('read-pkg')
|
||||
const { version } = await readPackage()
|
||||
const age = getAge(DIVLO_BIRTHDAY)
|
||||
const description = getDefaultDescription(age)
|
||||
return { props: { version, description } }
|
||||
return { props: { version } }
|
||||
}
|
||||
|
||||
export default Error500
|
||||
|
@ -12,26 +12,21 @@ import { Skills } from 'components/Skills'
|
||||
import { OpenSource } from 'components/OpenSource'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { getDefaultDescription } from 'utils/getDefaultDescription'
|
||||
import { DIVLO_BIRTHDAY, getAge } from 'utils/getAge'
|
||||
|
||||
interface HomeProps extends FooterProps {
|
||||
description: string
|
||||
age: number
|
||||
}
|
||||
interface HomeProps extends FooterProps {}
|
||||
|
||||
const Home: NextPage<HomeProps> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
const { version, description, age } = props
|
||||
const { version } = props
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head description={description} />
|
||||
<Head />
|
||||
|
||||
<Header showLanguage />
|
||||
<main className='flex flex-col md:mx-auto md:max-w-4xl lg:max-w-7xl'>
|
||||
<Section isMain id='about'>
|
||||
<Profile age={age} />
|
||||
<Profile />
|
||||
<SocialMediaList />
|
||||
</Section>
|
||||
|
||||
@ -79,9 +74,7 @@ const Home: NextPage<HomeProps> = (props) => {
|
||||
export const getStaticProps: GetStaticProps<HomeProps> = async () => {
|
||||
const { readPackage } = await import('read-pkg')
|
||||
const { version } = await readPackage()
|
||||
const age = getAge(DIVLO_BIRTHDAY)
|
||||
const description = getDefaultDescription(age)
|
||||
return { props: { version, description, age } }
|
||||
return { props: { version } }
|
||||
}
|
||||
|
||||
export default Home
|
||||
|
Reference in New Issue
Block a user