@@ -2,17 +2,23 @@ import Link from '@components/link';
22import styles from './block-entry.module.css' ;
33import { convertMDWithInlineCodeToHTML } from '@lib/utils' ;
44import { ExternalLink } from '@components/icons' ;
5+ import { PostEntry } from '@lib/types' ;
56
6- type Props = {
7- title : string ;
8- href : string ;
9- date ?: Date ;
7+ // type Props = {
8+ // title: string;
9+ // href: string;
10+ // date?: Date;
11+ // dateInfo?: string;
12+ // isThirdParty?: boolean;
13+ // };
14+
15+ type BlockEntryProps = Pick < PostEntry , 'title' | 'date' | 'isThirdParty' > & {
1016 dateInfo ?: string ;
11- thirdPartyPost ?: boolean ;
17+ href : string ;
1218} ;
1319
14- export default function BlockEntry ( props : Props ) {
15- const { title, href , date, dateInfo, thirdPartyPost } = props ;
20+ export default function BlockEntry ( props : BlockEntryProps ) {
21+ const { title, date, dateInfo, isThirdParty , href } = props ;
1622
1723 return (
1824 < li className = { styles . item } >
@@ -21,15 +27,15 @@ export default function BlockEntry(props: Props) {
2127 title = { title }
2228 className = { styles . link }
2329 underline = { false }
24- external = { thirdPartyPost }
30+ external = { isThirdParty }
2531 >
2632 { /* {type && <div className={styles.type}>{type}</div> } */ }
2733 { date && (
2834 < div className = { styles . wrapper } >
2935 { date && (
3036 < span className = { styles . date } >
31- { dateInfo && dateInfo } { ' ' }
32- { date . toLocaleDateString ( 'en-US' , {
37+ { dateInfo && dateInfo } { ' ' }
38+ { new Date ( date ) . toLocaleDateString ( 'en-US' , {
3339 month : 'short' ,
3440 day : 'numeric' ,
3541 year : 'numeric' ,
@@ -45,7 +51,7 @@ export default function BlockEntry(props: Props) {
4551 __html : convertMDWithInlineCodeToHTML ( title ) ,
4652 } }
4753 > </ h4 >
48- { thirdPartyPost && < ExternalLink /> }
54+ { isThirdParty && < ExternalLink /> }
4955 </ div >
5056 { /* {description && <p className={styles.description}>{description}</p> } */ }
5157 </ Link >
0 commit comments