-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): add latest cases to court page
- Loading branch information
Showing
4 changed files
with
43 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { useMemo } from "react"; | ||
import styled from "styled-components"; | ||
import { Dispute_Filter } from "../graphql/graphql"; | ||
import { DisputeDetailsFragment, useCasesQuery } from "queries/useCasesQuery"; | ||
import DisputeCard from "components/DisputeCard"; | ||
import { StyledSkeleton } from "components/StyledSkeleton"; | ||
import { isUndefined } from "utils/index"; | ||
|
||
const Container = styled.div` | ||
margin-top: calc(64px + (80 - 64) * (min(max(100vw, 375px), 1250px) - 375px) / 875); | ||
`; | ||
|
||
const Title = styled.h1` | ||
margin-bottom: calc(16px + (48 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875); | ||
`; | ||
|
||
const DisputeContainer = styled.div` | ||
display: flex; | ||
gap: 24px; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
`; | ||
|
||
const LatestCases: React.FC<{ filters?: Dispute_Filter }> = ({ filters }) => { | ||
const { data } = useCasesQuery(0, 3, filters); | ||
const disputes: DisputeDetailsFragment[] = useMemo(() => data?.disputes as DisputeDetailsFragment[], [data]); | ||
|
||
return isUndefined(disputes) || disputes.length > 0 ? ( | ||
<Container> | ||
<Title>Latest Cases</Title> | ||
<DisputeContainer> | ||
{isUndefined(disputes) | ||
? Array.from({ length: 3 }).map((_, index) => <StyledSkeleton key={index} width={312} height={260} />) | ||
: disputes.map((dispute) => <DisputeCard key={dispute.id} {...dispute} overrideIsList />)} | ||
</DisputeContainer> | ||
</Container> | ||
) : null; | ||
}; | ||
|
||
export default LatestCases; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters