generated from UnBArqDsw2024-1/RepositoryTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from UnBArqDsw2024-1/feat/show-articles
Feat/show articles
- Loading branch information
Showing
11 changed files
with
125 additions
and
45 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
33 changes: 17 additions & 16 deletions
33
frontend/src/components/Article/ArticleCard/ArticleCard.tsx
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
14 changes: 7 additions & 7 deletions
14
frontend/src/components/Article/ArticleGrid/ArticleGrid.tsx
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
15 changes: 11 additions & 4 deletions
15
frontend/src/components/Article/ArticleSection/ArticleSection.tsx
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useEffect, useState } from "react"; | ||
import { articles, IArticle } from "../../utils/article-helper"; | ||
import ArticleGrid from "../../components/Article/ArticleGrid/ArticleGrid"; | ||
|
||
const Articles = () => { | ||
const [articlesData, setArticles] = useState<IArticle[]>([]); | ||
|
||
useEffect(() => { | ||
setArticles(articles); | ||
}, [articlesData]); | ||
|
||
return ( | ||
<main className="w-full max-w-[1250px] mx-auto h-full h-min-screen p-5 lg:mt-20"> | ||
<div className="w-full flex flex-col justify-center items-center gap-3 p-5"> | ||
<h3 className="text-black font-bold text-4xl">Artigos</h3> | ||
<p className="text-medium text-xl text-center">Aproveite toda nossa biblioteca de artigos</p> | ||
</div> | ||
|
||
<ArticleGrid articles={articlesData} /> | ||
</main> | ||
) | ||
} | ||
|
||
export default Articles |
26 changes: 26 additions & 0 deletions
26
frontend/src/pages/Articles/SingleArticle/SingleArticle.tsx
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useParams } from "react-router-dom" | ||
import { articles } from "../../../utils/article-helper" | ||
|
||
const SingleArticle = () => { | ||
const { id } = useParams<{ id: string }>(); | ||
const article = articles.find((article) => article.id === Number(id)); | ||
|
||
if (!article) { | ||
return <div>Artigo não encontrado</div>; | ||
} | ||
|
||
return ( | ||
<section className="w-full h-full min-h-screen max-w-4xl mx-auto p-5 lg:mt-20"> | ||
<img | ||
src={article.img.src} | ||
alt={article.img.alt} | ||
className="w-full h-auto mb-4" | ||
/> | ||
<h1 className="text-3xl font-bold mb-2">{article.title}</h1> | ||
<h2 className="text-xl font-medium mb-4">por {article.author}</h2> | ||
<p className="text-base">{article.description}</p> | ||
</section> | ||
) | ||
} | ||
|
||
export default SingleArticle |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.