-
Notifications
You must be signed in to change notification settings - Fork 1
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
8 changed files
with
126 additions
and
15 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
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,32 @@ | ||
import React from "react"; | ||
import Modal from "react-modal"; | ||
import { Link } from "react-router-dom"; | ||
|
||
import { ReactComponent as WinnerIcon } from "./medal-solid.svg"; | ||
import { ReactComponent as MedalIcon } from "./frown-regular.svg"; | ||
import styles from "./WinnerModal.module.scss"; | ||
|
||
export default function WinnerModal({ history, winnerTeam }) { | ||
return ( | ||
<Modal | ||
isOpen={true} | ||
onRequestClose={() => { | ||
history.replace("/partidas"); | ||
}} | ||
overlayClassName={styles.overlay} | ||
className={styles.modal} | ||
> | ||
{winnerTeam === "we" ? ( | ||
<WinnerIcon className={styles.winnerIcon} /> | ||
) : ( | ||
<MedalIcon className={styles.looserIcon} /> | ||
)} | ||
<h2 className={styles.title}> | ||
{winnerTeam === "we" ? "¡Has ganado!" : "¡Has perdido!"} | ||
</h2> | ||
<Link className={styles.returnLink} to="/partidas"> | ||
Volver al inicio | ||
</Link> | ||
</Modal> | ||
); | ||
} |
51 changes: 51 additions & 0 deletions
51
client/src/screens/Match/WinnerModal/WinnerModal.module.scss
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,51 @@ | ||
.overlay { | ||
position: fixed; | ||
top: 0px; | ||
left: 0px; | ||
right: 0px; | ||
bottom: 0px; | ||
background-color: rgba(0, 0, 0, 0.25); | ||
} | ||
|
||
.modal { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
width: 240px; | ||
background-color: #191a23; | ||
border-radius: 4px; | ||
padding: 24px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
box-shadow: 0px 0px 8px 0px #000; | ||
} | ||
|
||
.looserIcon, | ||
.winnerIcon { | ||
width: 60px; | ||
margin-bottom: 16px; | ||
} | ||
|
||
.winnerIcon { | ||
color: #ffc21a; | ||
} | ||
|
||
.looserIcon { | ||
color: #dc494d; | ||
} | ||
|
||
.title { | ||
margin: 0 0 32px 0; | ||
} | ||
|
||
.returnLink { | ||
text-decoration: none; | ||
width: 160px; | ||
padding: 8px; | ||
border: 1px solid #fff; | ||
color: #fff; | ||
text-align: center; | ||
border-radius: 40px; | ||
} |
29 changes: 29 additions & 0 deletions
29
client/src/screens/Match/WinnerModal/WinnerModal.stories.js
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 React from "react"; | ||
import { storiesOf } from "@storybook/react"; | ||
import faker from "faker"; | ||
|
||
import WinnerModal from "./WinnerModal"; | ||
|
||
const Wrapper = ({ children }) => ( | ||
<div | ||
style={{ | ||
width: "100%", | ||
height: "100vh", | ||
position: "relative" | ||
}} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
storiesOf("WinnerModal", module) | ||
.add("winner", () => ( | ||
<Wrapper> | ||
<WinnerModal winnerTeam="we" /> | ||
</Wrapper> | ||
)) | ||
.add("looser", () => ( | ||
<Wrapper> | ||
<WinnerModal winnerTeam="them" /> | ||
</Wrapper> | ||
)); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 @@ | ||
import WinnerModal from "./WinnerModal"; | ||
|
||
export default WinnerModal; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.