@@ -14,6 +14,9 @@ import stylesLandingPage from '../../LandingPage.module.css';
14
14
import { classNames } from '@/util/utils' ;
15
15
16
16
import styles from './NewsPage.module.css' ;
17
+ import ProgressiveImage from '../ProgressiveImage' ;
18
+ import SanityContentRTF from '../SanityContentRTF' ;
19
+ import Menu from '../../layout/Menu' ;
17
20
18
21
export interface NewsPageProps {
19
22
className ?: string ;
@@ -23,15 +26,44 @@ export interface NewsPageProps {
23
26
export default function NewsPage ( { className, slug } : NewsPageProps ) {
24
27
const news = useSanityContentForNewsItem ( slug ) ;
25
28
26
- if ( ! news ) return < LandingPage section = { EnumSection . News } /> ;
29
+ if ( ! news ) {
30
+ return < LandingPage section = { EnumSection . News } /> ;
31
+ }
27
32
28
33
return (
29
34
< div className = { classNames ( className , stylesLandingPage . landingPage ) } >
30
- < PaddedBlock className = { classNames ( className , styles . newsPage ) } >
31
- < Title value = { news . title } />
32
- < div className = { styleBlockSmall } > { news . article && < Text value = { news . article } /> } </ div >
35
+ < div className = { styles . blueBackground } >
36
+ < div />
37
+ </ div >
38
+ < Menu scrollHasStarted section = { EnumSection . News } />
39
+ < PaddedBlock >
40
+ < header className = { classNames ( styles . header , styleBlockSmall ) } >
41
+ < h2 > NEWS</ h2 >
42
+ < h1 > { news . title } </ h1 >
43
+ < div className = { styles . notes } >
44
+ < div > Published { formatDate ( news . date ) } </ div >
45
+ < div > © Copyright 2024, EPFL / BBP</ div >
46
+ </ div >
47
+ </ header >
48
+ < ProgressiveImage
49
+ className = { classNames ( styles . image , styleBlockSmall ) }
50
+ forceAspectRatio
51
+ src = { news . imageURL }
52
+ width = { news . imageWidth }
53
+ height = { news . imageHeight }
54
+ />
55
+ < div className = { styleBlockSmall } >
56
+ { news . article && < SanityContentRTF value = { news . article } /> }
57
+ </ div >
33
58
</ PaddedBlock >
34
59
< FooterPanel section = { EnumSection . News } />
35
60
</ div >
36
61
) ;
37
62
}
63
+
64
+ function formatDate ( d : string ) {
65
+ const date = new Date ( d ) ;
66
+ const fmt = new Intl . DateTimeFormat ( 'en' , { dateStyle : 'long' } ) ;
67
+ return fmt . format ( date ) ;
68
+ }
69
+
0 commit comments