This file contains hidden or 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
import React, { useRef } from 'react' | |
const App = () => { | |
const inputRef = useRef() | |
return ( | |
<div> | |
<h1>Upload Files</h1> | |
<p> |
This file contains hidden or 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
[ | |
{ | |
"away":{ | |
"stat_name":"score", | |
"stat_value":395, | |
"league_high":509, | |
"team_rank":17 | |
}, | |
"home":{ | |
"stat_name":"score", |
This file contains hidden or 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
<BarGroup> | |
<Bar rotate={180}> | |
<Filler | |
color="#F5B947" | |
width={handleBarWidth(away.stat_value, away.league_high)} | |
/> | |
</Bar> | |
<Bar> | |
<Filler |
This file contains hidden or 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
const Bar = styled.div` | |
position: relative; | |
height: 8px; | |
width: 49%; | |
background-color: #eeeeee; | |
border-radius: 50px; | |
margin-top: 2.5px; | |
transform: rotate(${(props) => props.rotate || 0}deg); | |
`; |
This file contains hidden or 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
const StatRow = ({ stat }) => { | |
const { away, home } = stat; | |
const handleBarWidth = (value, high) => { | |
return Math.floor((value / high) * 100); | |
}; | |
return ( | |
<div> | |
<Stat> |
This file contains hidden or 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
const StatRow = ({ stat }) => { | |
const { away, home } = stat; | |
return ( | |
<div> | |
<Stat> | |
<div> | |
<TeamRank marginRight={10}>#{away.team_rank}</TeamRank> | |
<StatValue>{away.stat_value}</StatValue> | |
</div> |
This file contains hidden or 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
const Filler = styled.div` | |
background-color: ${(props) => props.color || "transparent"}; | |
width: ${(props) => props.width}%; | |
height: 100%; | |
border-radius: 50px; | |
`; |
This file contains hidden or 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
const StatRow = ({ stat }) => { | |
const { away, home } = stat; | |
return ( | |
<div> | |
<Stat> | |
<div> | |
<TeamRank marginRight={10}>#{away.team_rank}</TeamRank> | |
<StatValue>{away.stat_value}</StatValue> | |
</div> |
This file contains hidden or 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
const Bar = styled.div` | |
position: relative; | |
height: 8px; | |
width: 49%; | |
background-color: #eeeeee; | |
border-radius: 50px; | |
margin-top: 2.5px; | |
`; |
This file contains hidden or 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
// other code omitted for brevity | |
const BarGroup = styled.div` | |
display: flex; | |
flex-direction: row; | |
align-items: center; | |
justify-content: space-between; | |
width: 100%; | |
`; |