Skip to content

Commit 587101b

Browse files
sombraSoftmarcodmc
authored andcommitted
Substitui onClick e useNavigate por <Link> para melhorar acessibilidade (SOS-RS#128)
* replaced navigate in favour of html link and added card hover * fixed lint warnings
1 parent 5efa236 commit 587101b

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { SupplyMeasure } from '@/hooks/useShelter/types';
2+
import { SupplyPriority } from '@/service/supply/types';
3+
4+
export interface IDonationCartItem {
5+
id: string;
6+
name: string;
7+
quantity: number;
8+
priority: SupplyPriority;
9+
measure: SupplyMeasure;
10+
}
11+
12+
export interface IDonationCartContext {
13+
carts: Record<string, IDonationCartItem[]>;
14+
opened: boolean;
15+
toggleOpened: () => void;
16+
addItem: (shelterId: string, item: IDonationCartItem) => void;
17+
removeItem: (shelterId: string, supplyId: string) => void;
18+
updateItem: (
19+
shelterId: string,
20+
supplyId: string,
21+
payload: Partial<Omit<IDonationCartItem, 'id'>>
22+
) => void;
23+
clearCart: (shelterId: string) => void;
24+
updateCart: (shelterId: string, items: IDonationCartItem[]) => void;
25+
}

src/pages/Home/Home.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
2-
import { useNavigate, useSearchParams } from 'react-router-dom';
32
import { RotateCw, LogOutIcon, PlusIcon } from 'lucide-react';
43
import qs from 'qs';
54

@@ -10,6 +9,7 @@ import { SessionContext } from '@/contexts';
109
import { Filter } from './components/Filter';
1110
import { ShelterListView } from './components/ShelterListView';
1211
import { IFilterFormProps } from './components/Filter/types';
12+
import { useSearchParams } from 'react-router-dom';
1313

1414
const initialFilterData: IFilterFormProps = {
1515
search: '',
@@ -49,7 +49,6 @@ const Home = () => {
4949
},
5050
[]
5151
);
52-
const navigate = useNavigate();
5352

5453
const clearSearch = useCallback(() => {
5554
setSearch('');
@@ -183,7 +182,6 @@ const Home = () => {
183182
setFilterData((prev) => ({ ...prev, search: v }));
184183
setSearch(v);
185184
}}
186-
onSelectShelter={(s) => navigate(`/abrigo/${s.id}`)}
187185
hasMoreItems={hasMore}
188186
onOpenModal={() => setOpenModal(true)}
189187
onClearSearch={clearSearch}

0 commit comments

Comments
 (0)