diff --git a/src/components/NewsSection/NewsEntry/index.tsx b/src/components/NewsSection/NewsEntry/index.tsx index aa7b83f..bc88b36 100644 --- a/src/components/NewsSection/NewsEntry/index.tsx +++ b/src/components/NewsSection/NewsEntry/index.tsx @@ -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 = ({ title, postBadge, author }: Props) => { - return
- -
-
-
- {postBadge} +const NewsEntry: React.FC = ({ article }: Props) => { + return +
+ +
+
+
+ {article.type} +
+ {article.title}
- {title} -
-
- -
- By: {author} +
+ {`${article.author}'s +
+ By: {article.author} +
-
; + ; }; export default NewsEntry; \ No newline at end of file diff --git a/src/components/NewsSection/index.tsx b/src/components/NewsSection/index.tsx index dade179..9c59fbc 100644 --- a/src/components/NewsSection/index.tsx +++ b/src/components/NewsSection/index.tsx @@ -2,7 +2,6 @@ import { NewsIcon } from "@app/assets/Icons"; import styles from "./NewsSection.module.css"; import NewsEntry from "./NewsEntry"; import { useNews } from "@app/hooks/useNews"; -import { Link } from "react-router-dom"; const NewsSection: React.FC = () => { const { data, error, isLoading, isSuccess } = useNews(); @@ -11,7 +10,7 @@ const NewsSection: React.FC = () => { if (error) return `An error has occurred: ${error}`; - if(isSuccess) { + if (isSuccess) { return
@@ -19,11 +18,7 @@ const NewsSection: React.FC = () => {
{ - Array.from(data.articles).map(article => - - - - ) + Array.from(data.articles).map(article => ) }
; } diff --git a/src/routes/NewsPage/NewsPage.module.css b/src/routes/NewsPage/NewsPage.module.css index d6bd0d7..d6963dc 100644 --- a/src/routes/NewsPage/NewsPage.module.css +++ b/src/routes/NewsPage/NewsPage.module.css @@ -17,10 +17,10 @@ .content { display: flex; flex-direction: column; - gap: 25px; + gap: 5px; padding: 25px 50px 50px 50px; - color: #7A7A7A; - --primary: #7A7A7A; + color: #333; + --primary: #333; } .content a { diff --git a/src/routes/NewsPage/index.tsx b/src/routes/NewsPage/index.tsx index 71c393e..cdd03f7 100644 --- a/src/routes/NewsPage/index.tsx +++ b/src/routes/NewsPage/index.tsx @@ -11,9 +11,8 @@ import { Img } from "react-image"; import UnknownUserIcon from "@app/assets/Icons/UnknownUser.svg"; function NewsPage() { - const { md } = useParams(); - if(!md) return <>; + if (!md) return <>; const { data, error, isLoading, isSuccess } = useNewsArticle(md); @@ -21,22 +20,19 @@ function NewsPage() { if (error) return `An error has occurred: ${error}`; - if(isSuccess) { - + if (isSuccess) { const { data: articleData, content } = matter(data); - return (<> - -
+ return <> +
{articleData.type}
{articleData.title}
-
- {`${articleData.author}'s{articleData.role}
- {/*
16 minutes ago
*/}
- - +
- ); + ; } }