Skip to content

Commit

Permalink
feat: ✨ improve markets losers search
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Apr 15, 2024
1 parent 636cb41 commit 2185b01
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/views/tables/MarketsCompactTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ export const MarketsCompactTable = (props: PropsWithChildren<MarketsCompactTable
: marketA.priceChange24HPercent - marketB.priceChange24HPercent;
};

if (sorting === MarketSorting.LOSERS) {
return filteredMarkets
.filter((market) => !!market.priceChange24HPercent && market.priceChange24HPercent < 0)
.sort(sortingFunction);
}

return filteredMarkets.sort(sortingFunction);
}, [sorting, filteredMarkets]);

Expand Down Expand Up @@ -219,15 +225,35 @@ Styled.Table = styled(Table)`
@media ${breakpoints.desktopSmall} {
--tableCell-padding: 0.5rem 0.5rem;
& tr > td:nth-child(1) {
--tableCell-padding: 0.5rem 0.5rem;
}
& tr > td:nth-child(2) {
--tableCell-padding: 0.625rem 0;
--tableCell-padding: 0.5rem 0;
}
& tr > td:nth-child(3) {
--tableCell-padding: 0.5rem 0.5rem;
}
}
@media ${breakpoints.tablet} {
table {
max-width: 100vw;
}
& tr > td:nth-child(1) {
--tableCell-padding: 0.5rem 0.625rem 0.5rem 1rem;
}
& tr > td:nth-child(2) {
--tableCell-padding: 0.5rem 0;
}
& tr > td:nth-child(3) {
--tableCell-padding: 0.5rem 1rem 0.5rem 0.625rem;
}
}
`;

Expand Down

0 comments on commit 2185b01

Please sign in to comment.