Created
October 26, 2021 22:08
-
-
Save julianwachholz/dc15d5533f10f9d503901cba2787f35c to your computer and use it in GitHub Desktop.
SVG latency icon using tailwind utilities
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
const LatencyIcon = ({ latency }) => { | |
return ( | |
<svg | |
xmlns="http://www.w3.org/2000/svg" | |
className="inline-block h-5 w-5 text-gray-800" | |
viewBox="0 0 20 20" | |
fill="currentColor" | |
> | |
<path | |
className={ | |
latency < 200 | |
? "text-green-400" | |
: latency < 500 | |
? "text-yellow-400" | |
: latency < 1000 | |
? "text-red-400" | |
: "" | |
} | |
d="M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5z" | |
/> | |
<path | |
className={ | |
latency < 200 | |
? "text-green-400" | |
: latency < 500 | |
? "text-yellow-400" | |
: "" | |
} | |
d="M8 7a1 1 0 011-1h2a1 1 0 011 1v9a1 1 0 01-1 1H9a1 1 0 01-1-1V7zM14 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1h-2a1 1 0 01-1-1V4z" | |
/> | |
<path | |
className={latency < 200 ? "text-green-400" : ""} | |
d="M14 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1h-2a1 1 0 01-1-1V4z" | |
/> | |
</svg> | |
); | |
}; | |
export default LatencyIcon; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment