Skip to content

Commit

Permalink
📝 formatação da home
Browse files Browse the repository at this point in the history
  • Loading branch information
joseandre25 committed Oct 24, 2023
1 parent 256e93f commit 105a961
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Empty file.
19 changes: 14 additions & 5 deletions src/components/Pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from "next/image";
import { useState, useEffect } from "react"

interface TitleProps {
municipio: string;
ano: string;
Expand All @@ -8,6 +9,7 @@ interface TitleProps {
export const Home = ({ municipio, ano }: TitleProps) => {
const [titleText, setTitleText] = useState("Brasília");
const [bids, setBids] = useState<any>([]);

const buildTitle = () => {
fetch(`https://raw.githubusercontent.com/unb-mds/2023-2-Squad07/main/public/resultados.json`, {
method: 'GET',
Expand All @@ -21,9 +23,17 @@ export const Home = ({ municipio, ano }: TitleProps) => {
if (municipio === 'geral') {
setTitleText('Ceará')
}
}, [setTitleText, municipio]);
}, [municipio]);

// Função para formatar a saída dos avisos
const formatAviso = (bid: any) => {
return (
<div className="aviso">
No dia <span className="text-red-500">{bid.pdf_filename.replace(/APRECE_(\d{2})_(\d{2})_(\d{2}).pdf/, '$1/$2/$3')}</span> houveram <span className="text-red-500">{bid.num_avisos_licitacao} avisos de licitação</span>.
</div>
);
};

console.log()
return (
<div className="flex">
<div className="bg-teal-500 w-80 h-screen p-4">
Expand Down Expand Up @@ -53,12 +63,11 @@ export const Home = ({ municipio, ano }: TitleProps) => {
<div className="font-semibold">
{bids.map((bid: any, i: number) => (
<div key={i} className="flex-row pt-5 pb-5">
<>{bid.pdf_filename}</>
<>{bid.num_avisos_licitacao}</>
{formatAviso(bid)}
</div>
))}
</div>
</div>
</div>
)
}
}

0 comments on commit 105a961

Please sign in to comment.