File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change
1
+ 'use client'
2
+
3
+ import { useEffect , useState } from 'react'
4
+
5
+ export default function CurrentYear ( ) {
6
+ const [ year , setYear ] = useState ( new Date ( ) . getFullYear ( ) )
7
+
8
+ useEffect ( ( ) => {
9
+ setYear ( new Date ( ) . getFullYear ( ) )
10
+ } , [ ] )
11
+
12
+ return < div > { `© ${ year } ` } </ div >
13
+ }
Original file line number Diff line number Diff line change 1
1
import Link from './Link'
2
2
import siteMetadata from '@/data/siteMetadata'
3
3
import SocialIcon from '@/components/social-icons'
4
+ import CurrentYear from './CurrentYear'
4
5
6
+ // Server component for the footer
5
7
export default function Footer ( ) {
6
8
return (
7
9
< footer className = "mt-auto" >
@@ -21,7 +23,7 @@ export default function Footer() {
21
23
< div className = "mb-2 flex space-x-2 text-sm text-gray-500 dark:text-gray-400" >
22
24
< div > { siteMetadata . author } </ div >
23
25
< div > { ` • ` } </ div >
24
- < div > { `© ${ new Date ( ) . getFullYear ( ) } ` } </ div >
26
+ < CurrentYear / >
25
27
< div > { ` • ` } </ div >
26
28
< Link href = "/" > { siteMetadata . title } </ Link >
27
29
</ div >
You can’t perform that action at this time.
0 commit comments