Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): feedback by plinio implementation #1253

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions web/src/components/CasesDisplay/CasesGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useMemo } from "react";
import styled, { css } from "styled-components";
import styled from "styled-components";
import { useWindowSize } from "react-use";
import { useParams } from "react-router-dom";
import Skeleton from "react-loading-skeleton";
import { SkeletonDisputeCard, SkeletonDisputeListItem } from "../StyledSkeleton";
import { StandardPagination } from "@kleros/ui-components-library";
import { BREAKPOINT_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle";
import { BREAKPOINT_LANDSCAPE } from "styles/landscapeStyle";
import { useIsList } from "context/IsListProvider";
import { isUndefined } from "utils/index";
import { decodeURIFilter } from "utils/uri";
Expand All @@ -17,17 +17,7 @@ const GridContainer = styled.div`
flex-wrap: wrap;
justify-content: center;
align-items: center;
gap: 8px;
${landscapeStyle(
() =>
css`
display: grid;
row-gap: 16px;
column-gap: 8px;
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
justify-content: space-between;
`
)}
gap: 24px;
`;

const ListContainer = styled.div`
Expand All @@ -37,11 +27,6 @@ const ListContainer = styled.div`
gap: 8px;
`;

const StyledSkeleton = styled(Skeleton)`
height: 260px;
width: 310px;
`;

// 24px as margin-top since we already have 8px from the flex gap
const StyledPagination = styled(StandardPagination)`
margin-top: 24px;
Expand Down Expand Up @@ -71,15 +56,15 @@ const CasesGrid: React.FC<ICasesGrid> = ({ disputes, casesPerPage, totalPages, c
<ListContainer>
<CasesListHeader />
{isUndefined(disputes)
? [...Array(casesPerPage)].map((_, i) => <StyledSkeleton key={i} />)
? [...Array(casesPerPage)].map((_, i) => <SkeletonDisputeListItem key={i} />)
: disputes.map((dispute) => {
return <DisputeCard key={dispute.id} {...dispute} />;
})}
</ListContainer>
) : (
<GridContainer>
{isUndefined(disputes)
? [...Array(casesPerPage)].map((_, i) => <StyledSkeleton key={i} />)
? [...Array(casesPerPage)].map((_, i) => <SkeletonDisputeCard key={i} />)
: disputes.map((dispute) => {
return <DisputeCard key={dispute.id} {...dispute} overrideIsList />;
})}
Expand Down
10 changes: 8 additions & 2 deletions web/src/components/DisputeCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ import PeriodBanner from "./PeriodBanner";
import { isUndefined } from "utils/index";

const StyledCard = styled(Card)`
width: 312px;
width: 100%;
height: 260px;
${landscapeStyle(
() =>
css`
width: 380px;
/* Explanation of this formula:
- The 48px accounts for the total width of gaps: 2 gaps * 24px each.
- The 0.333 is used to equally distribute width among 3 cards per row.
- The 294px ensures the card has a minimum width.
*/
width: max(calc((100% - 48px) * 0.333), 294px);
`
)}
`;

const StyledListItem = styled(Card)`
display: flex;
flex-grow: 1;
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/LatestCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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 { SkeletonDisputeCard } from "components/StyledSkeleton";
import { isUndefined } from "utils/index";

const Container = styled.div`
Expand All @@ -30,7 +30,7 @@ const LatestCases: React.FC<{ filters?: Dispute_Filter }> = ({ filters }) => {
<Title>Latest Cases</Title>
<DisputeContainer>
{isUndefined(disputes)
? Array.from({ length: 3 }).map((_, index) => <StyledSkeleton key={index} width={312} height={260} />)
? Array.from({ length: 3 }).map((_, index) => <SkeletonDisputeCard key={index} />)
: disputes.map((dispute) => <DisputeCard key={dispute.id} {...dispute} overrideIsList />)}
</DisputeContainer>
</Container>
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Container = styled.div`
flex-direction: column;
align-items: center;
justify-content: center;
width: calc(300px + (600 - 300) * (100vw - 375px) / (1250 - 375));
width: 82vw;
max-width: 600px;
border-radius: 3px;
border: 1px solid ${({ theme }) => theme.stroke};
Expand All @@ -66,6 +66,7 @@ const Container = styled.div`
${landscapeStyle(
() => css`
overflow-y: hidden;
width: calc(300px + (600 - 300) * (100vw - 375px) / (1250 - 375));
`
)}
`;
Expand Down
35 changes: 34 additions & 1 deletion web/src/components/StyledSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
import styled from "styled-components";
import React from "react";
import styled, { css } from "styled-components";
import { landscapeStyle } from "styles/landscapeStyle";
import Skeleton from "react-loading-skeleton";

export const StyledSkeleton = styled(Skeleton)`
z-index: 0;
`;

const SkeletonDisputeCardContainer = styled.div`
width: 100%;
${landscapeStyle(
() =>
css`
/* Explanation of this formula:
- The 48px accounts for the total width of gaps: 2 gaps * 24px each.
- The 0.333 is used to equally distribute width among 3 cards per row.
- The 294px ensures the card has a minimum width.
*/
width: max(calc((100% - 48px) * 0.333), 294px);
`
)}
`;

const StyledSkeletonDisputeCard = styled(Skeleton)`
height: 260px;
`;

const StyledSkeletonDisputeListItem = styled(Skeleton)`
height: 62px;
`;

export const SkeletonDisputeCard = () => (
<SkeletonDisputeCardContainer>
<StyledSkeletonDisputeCard />
</SkeletonDisputeCardContainer>
);

export const SkeletonDisputeListItem = () => <StyledSkeletonDisputeListItem />;
6 changes: 4 additions & 2 deletions web/src/layout/Header/navbar/DappList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ const Header = styled.h1`
const Container = styled.div`
display: flex;
position: absolute;
max-height: 80vh;
max-height: 340px;
top: 5%;
left: 50%;
transform: translate(-50%);
z-index: 1;
flex-direction: column;
align-items: center;

width: calc(300px + (480 - 300) * (100vw - 375px) / (1250 - 375));
width: 82%;
max-width: 480px;
min-width: 300px;
border-radius: 3px;
Expand All @@ -52,6 +52,8 @@ const Container = styled.div`
left: 0;
right: auto;
transform: none;
width: calc(300px + (480 - 300) * (100vw - 375px) / (1250 - 375));
max-height: 80vh;
`
)}
`;
Expand Down
3 changes: 2 additions & 1 deletion web/src/layout/Header/navbar/Menu/Help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const Container = styled.div`
position: absolute;
max-height: 80vh;
overflow-y: auto;
width: auto;
width: 82%;
max-width: 444px;
top: 5%;
left: 50%;
transform: translateX(-50%);
Expand Down
10 changes: 8 additions & 2 deletions web/src/layout/Header/navbar/Menu/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const Container = styled.div`
position: absolute;
max-height: 80vh;
overflow-y: auto;
z-index: 1;
background-color: ${({ theme }) => theme.whiteBackground};
flex-direction: column;
top: 5%;
Expand Down Expand Up @@ -46,7 +45,14 @@ const StyledSettingsText = styled.div`

const StyledTabs = styled(Tabs)`
padding: 0 calc(8px + (32 - 8) * ((100vw - 300px) / (1250 - 300)));
width: calc(300px + (424 - 300) * ((100vw - 300px) / (1250 - 300)));
width: 82vw;
max-width: 660px;

${landscapeStyle(
() => css`
width: calc(300px + (424 - 300) * ((100vw - 300px) / (1250 - 300)));
`
)}
`;

const TABS = [
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Cases/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const Container = styled.div`
padding: calc(32px + (136 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-top: calc(32px + (80 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-bottom: calc(64px + (96 - 64) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
max-width: 1780px;
margin: 0 auto;
`;

const Cases: React.FC = () => (
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Courts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const Container = styled.div`
padding: calc(32px + (136 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-top: calc(32px + (80 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-bottom: calc(64px + (96 - 64) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
max-width: 1780px;
margin: 0 auto;
`;

const Courts: React.FC = () => {
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const Container = styled.div`
padding: calc(32px + (136 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-top: calc(32px + (80 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-bottom: calc(64px + (96 - 64) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
max-width: 1780px;
margin: 0 auto;
`;

const StyledCasesDisplay = styled(CasesDisplay)`
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Home/CourtOverview/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const StyledCard = styled(Card)`
padding-left: calc(16px + (35 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-bottom: 16px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));

${landscapeStyle(
() => css`
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const Container = styled.div`
padding: calc(32px + (132 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-top: calc(32px + (72 - 32) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
padding-bottom: calc(64px + (96 - 64) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
max-width: 1780px;
margin: 0 auto;
`;

const Home: React.FC = () => {
Expand Down
5 changes: 5 additions & 0 deletions web/src/styles/global-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export const GlobalStyle = createGlobalStyle`
color: ${({ theme }) => theme.primaryText};
}

textarea {
font-family: "Open Sans";
font-size: 14px;
}

small {
font-weight: 600;
font-size: 14px;
Expand Down