Skip to content

Commit

Permalink
fix(components): extract FooterTime client component
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Apr 16, 2024
1 parent 80ebd04 commit e3f676b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
17 changes: 3 additions & 14 deletions components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import FooterTime from './FooterTime'
import Col from '@/components/Col'
import Container from '@/components/Container'
import Divider from '@/components/Divider'
Expand All @@ -12,7 +13,7 @@ interface Props {
socials?: SiteConfig['socials']
}

function Footer({
export default function Footer({
buildTime,
author = siteConfig.author,
socials = siteConfig.socials,
Expand Down Expand Up @@ -60,21 +61,9 @@ function Footer({
</span>
</Col>
<Col className="mx-6">
<span>
Last Build Time
{' '}
<a href="https://github.com/sabertazimi/blog/actions">
<time
dateTime={new Date(buildTime).toLocaleString('zh-CN', { hour12: false })}
>
{new Date(buildTime).toLocaleString('zh-CN', { hour12: false })}
</time>
</a>
</span>
<FooterTime buildTime={buildTime} />
</Col>
</Row>
</Container>
)
}

export default Footer
24 changes: 24 additions & 0 deletions components/Footer/FooterTime.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client'

import type { BuildTime } from '@/types'

interface Props {
buildTime: BuildTime
}

export default function FooterTime({ buildTime }: Props) {
return (
<span>
Last Build Time
{' '}
<a href="https://github.com/sabertazimi/blog/actions">
<time
dateTime={new Date(buildTime).toLocaleString('zh-CN', { hour12: false })}
>
{new Date(buildTime).toLocaleString('zh-CN', { hour12: false })}
</time>
</a>
</span>

)
}

0 comments on commit e3f676b

Please sign in to comment.