-
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
1 parent
e18679d
commit a0c79a1
Showing
20 changed files
with
781 additions
and
10 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
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,102 @@ | ||
.CompactCard{ | ||
display: flex; | ||
flex: 1; | ||
height: 7rem!important; | ||
border-radius: 0.7rem; | ||
color: white; | ||
position: relative; | ||
cursor: pointer; | ||
padding: 1rem; | ||
} | ||
|
||
.CompactCard:hover{ | ||
box-shadow: none; | ||
} | ||
|
||
.radialBar{ | ||
display: flex; | ||
flex: 1; | ||
justify-content: flex-end; | ||
flex-direction: column ; | ||
gap: 1rem; | ||
} | ||
.CircularProgressbar{ | ||
width: 4rem!important; | ||
overflow: visible!important; | ||
|
||
} | ||
.CircularProgressbar-path{ | ||
stroke: white!important; | ||
stroke-width: 12px!important; | ||
filter: drop-shadow(2px 4px 6px white); | ||
} | ||
.CircularProgressbar-trail{ | ||
display: none; | ||
} | ||
.CircularProgressbar-text{ | ||
fill: white!important; | ||
} | ||
.radialBar span{ | ||
font-size: 17px; | ||
font-weight: bold; | ||
} | ||
|
||
/* detail */ | ||
.detail{ | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
flex: 1; | ||
align-items: flex-end; | ||
} | ||
.detail span:nth-child(2){ | ||
font-size: 22px; | ||
font-weight: bold; | ||
} | ||
.detail span:nth-child(3){ | ||
font-size: 12px; | ||
} | ||
/* Expanded Card */ | ||
.ExpandedCard{ | ||
position: absolute; | ||
width: 60%; | ||
height: 70vh; | ||
z-index: 9; | ||
left: 13rem; | ||
border-radius: 1rem; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 1rem; | ||
} | ||
.ExpandedCard span:nth-of-type(1){ | ||
color: white; | ||
font-size: 26px; | ||
font-weight: bold; | ||
text-shadow: 0px 0px 15px white; | ||
} | ||
.ExpandedCard span:nth-of-type(2){ | ||
color: white; | ||
font-size: 16px; | ||
} | ||
.chartContainer{ | ||
width: 70%; | ||
} | ||
|
||
@media screen and (max-width: 1200px){ | ||
.ExpandedCard{ | ||
top: 2rem; | ||
left: 6rem; | ||
height: 70vh; | ||
} | ||
} | ||
|
||
@media screen and (max-width: 768px){ | ||
.ExpandedCard{ | ||
top: 8rem; | ||
height: 50%; | ||
left: 15px; | ||
width: 80%; | ||
} | ||
} |
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,130 @@ | ||
import React, { useState } from 'react'; | ||
import './Card.css'; | ||
import { motion, AnimateSharedLayout } from "framer-motion"; | ||
import { CircularProgressbar } from "react-circular-progressbar"; | ||
import "react-circular-progressbar/dist/styles.css"; | ||
import {UilTimes} from '@iconscout/react-unicons'; | ||
import Chart from 'react-apexcharts' | ||
const Card = (props) => { | ||
|
||
const [expanded, setExpanded] = useState(false); | ||
|
||
return ( | ||
<div className="Card"> | ||
<AnimateSharedLayout> | ||
{ | ||
expanded?( | ||
<ExpandedCard param={props} setExpanded={()=>setExpanded(false)}/> | ||
): | ||
<CompactCard param={props} setExpanded={()=>setExpanded(true)}/> | ||
} | ||
</AnimateSharedLayout> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
//CompactCard | ||
function CompactCard({param,setExpanded}){ | ||
const Png=param.png; | ||
return( | ||
<motion.div className="CompactCard" | ||
style={ | ||
{ | ||
background:param.color.backGround, | ||
boxShadow:param.color.boxShadow | ||
}} | ||
onClick={setExpanded} | ||
layoutId='expandableCard' | ||
> | ||
|
||
<div className="radialBar"> | ||
<CircularProgressbar | ||
value={param.barValue} | ||
text={`${param.barValue}%`} | ||
/> | ||
<span>{param.title}</span> | ||
</div> | ||
<div className="detail"> | ||
<Png/> | ||
<span>${param.value}</span> | ||
<span>Last 24 hours</span> | ||
</div> | ||
</motion.div> | ||
) | ||
} | ||
|
||
//ExpandedCard | ||
function ExpandedCard({param,setExpanded}){ | ||
const data={ | ||
options: { | ||
chart: { | ||
type: "area", | ||
height: "auto", | ||
}, | ||
|
||
dropShadow: { | ||
enabled: false, | ||
enabledOnSeries: undefined, | ||
top: 0, | ||
left: 0, | ||
blur: 3, | ||
color: "#000", | ||
opacity: 0.35, | ||
}, | ||
|
||
fill: { | ||
colors: ["#fff"], | ||
type: "gradient", | ||
}, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
stroke: { | ||
curve: "smooth", | ||
colors: ["white"], | ||
}, | ||
tooltip: { | ||
x: { | ||
format: "dd/MM/yy HH:mm", | ||
}, | ||
}, | ||
grid: { | ||
show: true, | ||
}, | ||
xaxis: { | ||
type: "datetime", | ||
categories: [ | ||
"2018-09-19T00:00:00.000Z", | ||
"2018-09-19T01:30:00.000Z", | ||
"2018-09-19T02:30:00.000Z", | ||
"2018-09-19T03:30:00.000Z", | ||
"2018-09-19T04:30:00.000Z", | ||
"2018-09-19T05:30:00.000Z", | ||
"2018-09-19T06:30:00.000Z", | ||
], | ||
}, | ||
}, | ||
} | ||
return( | ||
<motion.div className="ExpandedCard" | ||
style={ | ||
{ | ||
background:param.color.backGround, | ||
boxShadow:param.color.boxShadow | ||
}} | ||
layoutId='expandableCard' | ||
> | ||
<div | ||
style={{alignSelf:'flex-end',cursor:'pointer',color:'white'}}> | ||
<UilTimes onClick={setExpanded}/> | ||
</div> | ||
<span>{param.title}</span> | ||
<div className="chartContainer"> | ||
<Chart series={param.series} type='area' options={data.options}/> | ||
</div> | ||
<span>Last 24 hours</span> | ||
</motion.div> | ||
) | ||
} | ||
export default Card |
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,23 @@ | ||
.Cards{ | ||
display: flex; | ||
gap:10px; | ||
} | ||
|
||
.parentContainer{ | ||
width: 100%; | ||
} | ||
|
||
@media screen and (max-width: 1200px){ | ||
.Cards{ | ||
flex-direction: column; | ||
} | ||
.parentContainer{ | ||
height: 9rem; | ||
} | ||
} | ||
|
||
@media screen and (max-width: 768px){ | ||
.Cards{ | ||
width: 90%; | ||
} | ||
} |
Oops, something went wrong.