Skip to content

Commit 70f0378

Browse files
fagundesjgmarcodmc
authored andcommitted
wip
1 parent 3285848 commit 70f0378

File tree

9 files changed

+70
-1
lines changed

9 files changed

+70
-1
lines changed

src/components/BurgerMenu/BurgerMenu.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
CircleHelp,
44
CirclePlus,
55
DoorOpen,
6+
HeartHandshake,
67
Info,
78
LinkIcon,
89
Menu,
@@ -65,6 +66,11 @@ const BurgerMenu = () => {
6566
link="/politica-de-privacidade"
6667
icon={<Info className="w-4 h-4" />}
6768
/>
69+
<BurguerMenuItem
70+
label="Apoiadores"
71+
link="/apoiadores"
72+
icon={<HeartHandshake className="w-4 h-4" />}
73+
/>
6874
<Separator />
6975
{partners.length > 0 && (
7076
<Fragment>

src/hooks/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useViaCep } from './useViaCep';
1111
import { usePartners } from './usePartners';
1212
import { useGithubContributors } from './useGithubContributors';
1313
import { useAuthRoles } from './useAuthRoles';
14+
import { useSupporters } from './useSupporters';
1415

1516
export {
1617
useShelters,
@@ -26,4 +27,5 @@ export {
2627
usePartners,
2728
useGithubContributors,
2829
useAuthRoles,
30+
useSupporters,
2931
};

src/hooks/useSupporters/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { useSupporters } from './useSupporters';
2+
3+
export { useSupporters };

src/hooks/useSupporters/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface ISupporter {
2+
id: string;
3+
name: string;
4+
imageUrl: string;
5+
link: string;
6+
createdAt: string;
7+
updatedAt?: string | null;
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useFetch } from '../useFetch';
2+
import { ISupporter } from './types';
3+
4+
const useSupporters = () => {
5+
return useFetch<ISupporter[]>('/supporters', {
6+
initialValue: [],
7+
cache: true,
8+
});
9+
};
10+
11+
export { useSupporters };
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { BurgerMenu, Header, LoadingScreen } from '@/components';
2+
import { useSupporters } from '@/hooks';
3+
4+
const Supporters = () => {
5+
const { data: supporters, loading } = useSupporters();
6+
7+
if (loading) return <LoadingScreen />;
8+
9+
return (
10+
<div className="flex flex-col h-screen items-center">
11+
<Header title="SOS Rio Grande do Sul" startAdornment={<BurgerMenu />} />
12+
<div className="flex flex-col gap-4 p-4 max-w-4xl pb-8 w-full">
13+
<h3 className="text-4xl font-semibold">Apoiadores do projeto</h3>
14+
<div className="flex flex-wrap">
15+
{supporters.map((supporter, idx) => (
16+
<div
17+
key={idx}
18+
className="flex flex-col justify-between p-4 w-full max-w-[30%] max-h-64 aspect-square border-2 border-border rounded-md hover:bg-zinc-200"
19+
>
20+
<h3 className="font-medium">{supporter.name}</h3>
21+
<div
22+
style={{ backgroundImage: `url('${supporter.imageUrl}')` }}
23+
className="bg-center h-full w-full bg-contain bg-no-repeat"
24+
/>
25+
</div>
26+
))}
27+
</div>
28+
</div>
29+
</div>
30+
);
31+
};
32+
33+
export { Supporters };

src/pages/Supporters/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Supporters } from './Supporters';
2+
3+
export { Supporters };

src/pages/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { SignIn } from './SignIn';
2-
32
import { Home } from './Home';
43
import { Shelter } from './Shelter';
54
import { EditShelterSupply } from './EditShelterSupply';
@@ -8,6 +7,7 @@ import { CreateShelter } from './CreateShelter';
87
import { UpdateShelter } from './UpdateShelter';
98
import { PrivacyPolicy } from './PrivacyPolicy';
109
import { AboutUs } from './AboutUs';
10+
import { Supporters } from './Supporters';
1111

1212
export {
1313
SignIn,
@@ -19,4 +19,5 @@ export {
1919
UpdateShelter,
2020
PrivacyPolicy,
2121
AboutUs,
22+
Supporters,
2223
};

src/routes/Routes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
UpdateShelter,
1111
PrivacyPolicy,
1212
AboutUs,
13+
Supporters,
1314
} from '@/pages';
1415

1516
const Routes = () => {
@@ -27,6 +28,7 @@ const Routes = () => {
2728
<Route path="/entrar" element={<SignIn />} />
2829
<Route path="/politica-de-privacidade" element={<PrivacyPolicy />} />
2930
<Route path="/sobre-nos" element={<AboutUs />} />
31+
<Route path="/apoiadores" element={<Supporters />} />
3032
<Route path="*" element={<Navigate to="/" />} />
3133
</Switch>
3234
);

0 commit comments

Comments
 (0)