Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fagundesjg committed May 16, 2024
1 parent 7398c9e commit b7f7dc3
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/components/BurgerMenu/BurgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CircleHelp,
CirclePlus,
DoorOpen,
HeartHandshake,
Info,
LinkIcon,
Menu,
Expand Down Expand Up @@ -65,6 +66,11 @@ const BurgerMenu = () => {
link="/politica-de-privacidade"
icon={<Info className="w-4 h-4" />}
/>
<BurguerMenuItem
label="Apoiadores"
link="/apoiadores"
icon={<HeartHandshake className="w-4 h-4" />}
/>
<Separator />
{partners.length > 0 && (
<Fragment>
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useViaCep } from './useViaCep';
import { usePartners } from './usePartners';
import { useGithubContributors } from './useGithubContributors';
import { useAuthRoles } from './useAuthRoles';
import { useSupporters } from './useSupporters';

export {
useShelters,
Expand All @@ -26,4 +27,5 @@ export {
usePartners,
useGithubContributors,
useAuthRoles,
useSupporters,
};
3 changes: 3 additions & 0 deletions src/hooks/useSupporters/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { useSupporters } from './useSupporters';

export { useSupporters };
8 changes: 8 additions & 0 deletions src/hooks/useSupporters/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface ISupporter {
id: string;
name: string;
imageUrl: string;
link: string;
createdAt: string;
updatedAt?: string | null;
}
11 changes: 11 additions & 0 deletions src/hooks/useSupporters/useSupporters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useFetch } from '../useFetch';
import { ISupporter } from './types';

const useSupporters = () => {
return useFetch<ISupporter[]>('/supporters', {
initialValue: [],
cache: true,
});
};

export { useSupporters };
33 changes: 33 additions & 0 deletions src/pages/Supporters/Supporters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { BurgerMenu, Header, LoadingScreen } from '@/components';
import { useSupporters } from '@/hooks';

const Supporters = () => {
const { data: supporters, loading } = useSupporters();

if (loading) return <LoadingScreen />;

return (
<div className="flex flex-col h-screen items-center">
<Header title="SOS Rio Grande do Sul" startAdornment={<BurgerMenu />} />
<div className="flex flex-col gap-4 p-4 max-w-4xl pb-8 w-full">
<h3 className="text-4xl font-semibold">Apoiadores do projeto</h3>
<div className="flex flex-wrap">
{supporters.map((supporter, idx) => (
<div
key={idx}
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"
>
<h3 className="font-medium">{supporter.name}</h3>
<div
style={{ backgroundImage: `url('${supporter.imageUrl}')` }}
className="bg-center h-full w-full bg-contain bg-no-repeat"
/>
</div>
))}
</div>
</div>
</div>
);
};

export { Supporters };
3 changes: 3 additions & 0 deletions src/pages/Supporters/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Supporters } from './Supporters';

export { Supporters };
3 changes: 2 additions & 1 deletion src/pages/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SignIn } from './SignIn';

import { Home } from './Home';
import { Shelter } from './Shelter';
import { EditShelterSupply } from './EditShelterSupply';
Expand All @@ -8,6 +7,7 @@ import { CreateShelter } from './CreateShelter';
import { UpdateShelter } from './UpdateShelter';
import { PrivacyPolicy } from './PrivacyPolicy';
import { AboutUs } from './AboutUs';
import { Supporters } from './Supporters';

export {
SignIn,
Expand All @@ -19,4 +19,5 @@ export {
UpdateShelter,
PrivacyPolicy,
AboutUs,
Supporters,
};
2 changes: 2 additions & 0 deletions src/routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
UpdateShelter,
PrivacyPolicy,
AboutUs,
Supporters,
} from '@/pages';

const Routes = () => {
Expand All @@ -27,6 +28,7 @@ const Routes = () => {
<Route path="/entrar" element={<SignIn />} />
<Route path="/politica-de-privacidade" element={<PrivacyPolicy />} />
<Route path="/sobre-nos" element={<AboutUs />} />
<Route path="/apoiadores" element={<Supporters />} />
<Route path="*" element={<Navigate to="/" />} />
</Switch>
);
Expand Down

0 comments on commit b7f7dc3

Please sign in to comment.