Last active
March 1, 2021 11:06
-
-
Save EileenJuergens/732113c55f61fc718f623b8076fd590f to your computer and use it in GitHub Desktop.
KPI Card Logic
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
import React from "react"; | |
import MediaQuery from "react-responsive"; | |
import Icon from "./icon.js"; | |
function KPICard({ title, value, icon, iconColor }) { | |
return ( | |
<div className="kpi-card"> | |
{/* Mobile view */} | |
<MediaQuery maxWidth={576}> | |
<div className="kpi-card__mobile__align kpi-card__style"> | |
<p className="kpi-card__mobile__title"> | |
{title} | |
</p> | |
<p className="kpi-card__mobile__value"> | |
{value} | |
</p> | |
</div> | |
</MediaQuery> | |
{/* Web view */} | |
<MediaQuery minWidth={576}> | |
<div className="kpi-card__web__align kpi-card__style"> | |
<div className="kpi-card__web__icon-text-container"> | |
<Icon icon={icon} color={iconColor} iconSize={24} /> | |
<p className="kpi-card__web__title"> | |
{title} | |
</p> | |
</div> | |
<p className="kpi-card__web__value"> | |
{value} | |
</p> | |
</div> | |
</MediaQuery> | |
</div> | |
); | |
} | |
export default KPICard; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment