-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
408 additions
and
26 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
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,29 @@ | ||
import { Item, ItemText, ItemWrap } from "./ParticipantsList-styled"; | ||
import { membersApi } from "../../Api/ApiRequest"; | ||
import { useParams } from "react-router-dom"; | ||
|
||
export const ParticipantsItem = ({ el, index }) => { | ||
const { id } = useParams(); | ||
const members = membersApi(); | ||
const participant = members.find((member) => member.id === el.member_id); | ||
|
||
const isHide = id === "2024-04-07" || id === "2024-04-21"; | ||
|
||
return ( | ||
<> | ||
<Item id={el.member_id}> | ||
<ItemWrap> | ||
<ItemText>{index + 1}.</ItemText> | ||
|
||
<ItemText>{participant?.name || "Невідомий учасник"}</ItemText> | ||
|
||
<ItemText>{isHide ? "?" : el.win}</ItemText> | ||
|
||
<ItemText>{isHide ? "?" : el.defeat}</ItemText> | ||
|
||
<ItemText>{isHide ? "?" : "rank"}</ItemText> | ||
</ItemWrap> | ||
</Item> | ||
</> | ||
); | ||
}; |
180 changes: 180 additions & 0 deletions
180
src/components/ParticipantsList/ParticipantsList-styled.jsx
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,180 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Section = styled.section` | ||
padding-bottom: 50px; | ||
min-height: 800px; | ||
background-color: var(--secondary-white-color); | ||
`; | ||
|
||
export const List = styled.ul``; | ||
|
||
export const Item = styled.li` | ||
position: relative; | ||
overflow: hidden; | ||
width: 100%; | ||
height: 50px; | ||
&:nth-child(odd) { | ||
background-color: var(--primary-white-color); | ||
} | ||
&:nth-child(even) { | ||
background-color: var(--secondary-white-color); | ||
} | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
@media screen and (min-width: 1200px) { | ||
&:hover { | ||
background-color: var(--primary-black-color); | ||
color: var(--primary-white-color); | ||
} | ||
} | ||
`; | ||
|
||
export const ItemWrap = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding-left: 24px; | ||
padding-right: 24px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
max-width: 1200px; | ||
width: 100%; | ||
height: 100%; | ||
`; | ||
|
||
export const ItemText = styled.p` | ||
overflow: hidden; | ||
display: flex; | ||
justify-content: left; | ||
align-items: center; | ||
height: 100%; | ||
font-size: 16px; | ||
font-weight: 400; | ||
&:nth-child(1) { | ||
width: 35px; | ||
} | ||
&:nth-child(2) { | ||
min-width: 100px; | ||
flex-grow: 1; | ||
} | ||
&:nth-child(3) { | ||
min-width: 50px; | ||
width: 10%; | ||
justify-content: center; | ||
border-right: 1px solid var(--primary-black-color); | ||
} | ||
&:nth-child(4) { | ||
min-width: 50px; | ||
width: 10%; | ||
justify-content: center; | ||
} | ||
&:nth-child(5) { | ||
min-width: 50px; | ||
width: 10%; | ||
justify-content: right; | ||
} | ||
`; | ||
|
||
export const Heading = styled.div` | ||
position: relative; | ||
overflow: hidden; | ||
width: 100%; | ||
height: 100px; | ||
background-color: var(--tertiary-white-color); | ||
color: var(--primary-black-color); | ||
`; | ||
|
||
export const HeadingWrap = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding-left: 24px; | ||
padding-right: 24px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
max-width: 1200px; | ||
width: 100%; | ||
height: 100%; | ||
`; | ||
|
||
export const HeadingText = styled.div` | ||
overflow: hidden; | ||
display: flex; | ||
justify-content: left; | ||
align-items: center; | ||
height: 100%; | ||
font-size: 16px; | ||
font-weight: 400; | ||
line-height: 1.6; | ||
&:nth-child(1) { | ||
width: 35px; | ||
} | ||
&:nth-child(2) { | ||
min-width: 100px; | ||
flex-grow: 1; | ||
} | ||
&:nth-child(3) { | ||
min-width: 50px; | ||
width: 10%; | ||
justify-content: center; | ||
border-right: 1px solid var(--primary-black-color); | ||
} | ||
&:nth-child(4) { | ||
min-width: 50px; | ||
width: 10%; | ||
justify-content: center; | ||
} | ||
&:nth-child(5) { | ||
min-width: 50px; | ||
width: 10%; | ||
justify-content: right; | ||
} | ||
`; | ||
|
||
export const Button = styled.button` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 10px; | ||
flex-shrink: 0; | ||
height: 50px; | ||
padding: 12px; | ||
border-radius: 50px; | ||
background-color: transparent; | ||
border: 2px solid var(--primary-white-color); | ||
color: var(--primary-white-color); | ||
font-size: 14px; | ||
font-weight: 400; | ||
transition: 250ms cubic-bezier(0.4, 0, 0.2, 1); | ||
&:hover { | ||
border: 2px solid var(--accent-hover-color); | ||
color: var(--accent-hover-color); | ||
} | ||
`; | ||
|
||
export const ButtonIconSvg = styled.svg` | ||
width: 20px; | ||
height: 20px; | ||
fill: currentColor; | ||
`; |
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,45 @@ | ||
import { useLocation, useNavigate } from "react-router-dom"; | ||
import { TitleSection } from "../TitleSection/TitleSection"; | ||
|
||
import { | ||
Button, | ||
ButtonIconSvg, | ||
List, | ||
Section, | ||
} from "./ParticipantsList-styled"; | ||
import { ParticipantsListHeading } from "./ParticipantsListHeading"; | ||
import sprite from "../../sprite.svg"; | ||
import { ParticipantsItem } from "./ParticipantsItem"; | ||
|
||
export const ParticipantsList = () => { | ||
const { state } = useLocation(); | ||
const navigate = useNavigate(); | ||
|
||
const handleBack = () => { | ||
navigate(-1); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Section> | ||
<TitleSection | ||
icon={"#icon-users"} | ||
title={"Кількість учасників: " + state?.players?.length} | ||
> | ||
<Button onClick={handleBack}> | ||
<ButtonIconSvg> | ||
<use href={sprite + "#icon-undo"}></use> | ||
</ButtonIconSvg> | ||
Назад | ||
</Button> | ||
</TitleSection> | ||
<List> | ||
<ParticipantsListHeading /> | ||
{state?.players?.map((el, index) => ( | ||
<ParticipantsItem key={el.member_id} el={el} index={index} /> | ||
))} | ||
</List> | ||
</Section> | ||
</> | ||
); | ||
}; |
39 changes: 39 additions & 0 deletions
39
src/components/ParticipantsList/ParticipantsListHeading.jsx
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,39 @@ | ||
import { | ||
ButtonIconSvg, | ||
Heading, | ||
HeadingText, | ||
HeadingWrap, | ||
} from "./ParticipantsList-styled"; | ||
import sprite from "../../sprite.svg"; | ||
|
||
export const ParticipantsListHeading = () => { | ||
return ( | ||
<> | ||
<Heading style={{ height: "50px" }}> | ||
<HeadingWrap> | ||
<HeadingText>№</HeadingText> | ||
|
||
<HeadingText>Учасник</HeadingText> | ||
|
||
<HeadingText> | ||
<ButtonIconSvg color="#00b64c"> | ||
<use href={sprite + "#icon-evil"}></use> | ||
</ButtonIconSvg> | ||
</HeadingText> | ||
|
||
<HeadingText> | ||
<ButtonIconSvg color="#b60000"> | ||
<use href={sprite + "#icon-sad"}></use> | ||
</ButtonIconSvg> | ||
</HeadingText> | ||
|
||
<HeadingText> | ||
<ButtonIconSvg color="#000000"> | ||
<use href={sprite + "#icon-star"}></use> | ||
</ButtonIconSvg> | ||
</HeadingText> | ||
</HeadingWrap> | ||
</Heading> | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.