Skip to content

Instantly share code, notes, and snippets.

@DZuz14
DZuz14 / App.js
Created June 9, 2021 18:39
useFileUpload1
import React, { useRef } from 'react'
const App = () => {
const inputRef = useRef()
return (
<div>
<h1>Upload Files</h1>
<p>
[
{
"away":{
"stat_name":"score",
"stat_value":395,
"league_high":509,
"team_rank":17
},
"home":{
"stat_name":"score",
<BarGroup>
<Bar rotate={180}>
<Filler
color="#F5B947"
width={handleBarWidth(away.stat_value, away.league_high)}
/>
</Bar>
<Bar>
<Filler
@DZuz14
DZuz14 / index.jsx
Created February 10, 2021 17:23
rotate
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);
`;
@DZuz14
DZuz14 / index.jsx
Created February 10, 2021 17:19
handlebarwidth
const StatRow = ({ stat }) => {
const { away, home } = stat;
const handleBarWidth = (value, high) => {
return Math.floor((value / high) * 100);
};
return (
<div>
<Stat>
@DZuz14
DZuz14 / index.jsx
Last active February 10, 2021 17:13
filler
const StatRow = ({ stat }) => {
const { away, home } = stat;
return (
<div>
<Stat>
<div>
<TeamRank marginRight={10}>#{away.team_rank}</TeamRank>
<StatValue>{away.stat_value}</StatValue>
</div>
@DZuz14
DZuz14 / index.jsx
Created February 10, 2021 17:06
filler
const Filler = styled.div`
background-color: ${(props) => props.color || "transparent"};
width: ${(props) => props.width}%;
height: 100%;
border-radius: 50px;
`;
@DZuz14
DZuz14 / index.jsx
Created February 10, 2021 16:56
baradded
const StatRow = ({ stat }) => {
const { away, home } = stat;
return (
<div>
<Stat>
<div>
<TeamRank marginRight={10}>#{away.team_rank}</TeamRank>
<StatValue>{away.stat_value}</StatValue>
</div>
@DZuz14
DZuz14 / index.jsx
Created February 10, 2021 16:52
bar
const Bar = styled.div`
position: relative;
height: 8px;
width: 49%;
background-color: #eeeeee;
border-radius: 50px;
margin-top: 2.5px;
`;
@DZuz14
DZuz14 / index.jsx
Created February 10, 2021 16:48
bargroup
// other code omitted for brevity
const BarGroup = styled.div`
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 100%;
`;