-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50f2486
commit 60dcc19
Showing
4 changed files
with
37 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
import { UnknownUserIcon } from "@app/assets/Icons"; | ||
import styles from "./NewsEntry.module.css"; | ||
import NewsBadge from "../NewsBadge"; | ||
import { ArticleData } from "@app/hooks/useNews"; | ||
import { Link } from "react-router-dom"; | ||
import { Img } from "react-image"; | ||
import UnknownUserIcon from "@app/assets/Icons/UnknownUser.svg"; | ||
|
||
interface Props { | ||
title: string; | ||
postBadge: string; | ||
author: string; | ||
article: ArticleData; | ||
} | ||
|
||
const NewsEntry: React.FC<Props> = ({ title, postBadge, author }: Props) => { | ||
return <div className={styles.container}> | ||
<img className={styles.thumbnail} /> | ||
<div className={styles.main}> | ||
<div className={styles.top_container}> | ||
<div className={styles.top}> | ||
<NewsBadge>{postBadge}</NewsBadge> | ||
const NewsEntry: React.FC<Props> = ({ article }: Props) => { | ||
return <Link to={`news/${article.md}`} key={article.md} style={{ width: "100%" }}> | ||
<div className={styles.container}> | ||
<img className={styles.thumbnail} src={`https://raw.githubusercontent.com/YARC-Official/News/master/images/thumbs/${article.thumb}`} /> | ||
<div className={styles.main}> | ||
<div className={styles.top_container}> | ||
<div className={styles.top}> | ||
<NewsBadge>{article.type}</NewsBadge> | ||
</div> | ||
{article.title} | ||
</div> | ||
{title} | ||
</div> | ||
<div className={styles.bottom_container}> | ||
<UnknownUserIcon /> | ||
<div> | ||
By: <span className={styles.author}>{author}</span> | ||
<div className={styles.bottom_container}> | ||
<Img | ||
height={24} | ||
alt={`${article.author}'s avatar`} | ||
src={[`https://raw.githubusercontent.com/YARC-Official/News/master/images/avatars/${article.avatar}`, UnknownUserIcon]} | ||
/> | ||
<div> | ||
By: <span className={styles.author}>{article.author}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div>; | ||
</Link>; | ||
}; | ||
|
||
export default NewsEntry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters