mirror of
https://github.com/FranP-code/Crypto-Prices.git
synced 2025-10-12 23:53:06 +00:00
Cards hover effect added
This commit is contained in:
@@ -5,6 +5,7 @@ import { Box, Card, CardContent, CardMedia, Grid, Typography } from '@mui/materi
|
|||||||
import { Chart as ChartJS } from 'chart.js/auto'
|
import { Chart as ChartJS } from 'chart.js/auto'
|
||||||
import { Chart, Line } from 'react-chartjs-2' //WTF https://stackoverflow.com/questions/67727603/error-category-is-not-a-registered-scale
|
import { Chart, Line } from 'react-chartjs-2' //WTF https://stackoverflow.com/questions/67727603/error-category-is-not-a-registered-scale
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
import { borderRadius } from '@mui/system';
|
||||||
|
|
||||||
const Crypto = ({CryptoStyles, data, cryptoPrices, dates, index, cryptoListLength, setLoading}) => {
|
const Crypto = ({CryptoStyles, data, cryptoPrices, dates, index, cryptoListLength, setLoading}) => {
|
||||||
|
|
||||||
@@ -20,6 +21,8 @@ const Crypto = ({CryptoStyles, data, cryptoPrices, dates, index, cryptoListLengt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [backgroundColor, setBackgroundColor] = useState("#ffffff0")
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|
||||||
// console.log(cryptoPrices[data.id].prices)
|
// console.log(cryptoPrices[data.id].prices)
|
||||||
@@ -51,6 +54,7 @@ const Crypto = ({CryptoStyles, data, cryptoPrices, dates, index, cryptoListLengt
|
|||||||
height="10vh"
|
height="10vh"
|
||||||
width="100%"
|
width="100%"
|
||||||
sx={{display: "flex", alignItems: "center"}}
|
sx={{display: "flex", alignItems: "center"}}
|
||||||
|
paddingRight="10px"
|
||||||
>
|
>
|
||||||
{data.name}
|
{data.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -110,7 +114,9 @@ const Crypto = ({CryptoStyles, data, cryptoPrices, dates, index, cryptoListLengt
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
className="line"
|
className="line"
|
||||||
style={{backgroundColor: "#ffffff0"}}
|
style={{backgroundColor: backgroundColor, boxSizing: "content-box", transition: "all 0.4s ease-in-out", borderRadius: "3px"}}
|
||||||
|
onMouseEnter={() => setBackgroundColor("#ffffff1a")}
|
||||||
|
onMouseLeave={() => setBackgroundColor("transparent")} // https://stackoverflow.com/questions/8739665/is-background-colornone-valid-css
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ const Cryptos = ({setLoading}) => {
|
|||||||
|
|
||||||
.card {
|
.card {
|
||||||
|
|
||||||
background: rgba( 78, 159, 255, 0) !important;
|
background: rgba( 78, 159, 255, 0);
|
||||||
|
backdrop-filter: blur( 14px );
|
||||||
|
-webkit-backdrop-filter: blur( 14px );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
@@ -44,6 +48,11 @@ const Cryptos = ({setLoading}) => {
|
|||||||
/* height: 80vh; */
|
/* height: 80vh; */
|
||||||
user-select: none;
|
user-select: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: 0.25s ease-in-out;
|
||||||
|
|
||||||
|
:hover {
|
||||||
|
background: #00f7ff5e;
|
||||||
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
|
|
||||||
@@ -189,10 +198,7 @@ const Cryptos = ({setLoading}) => {
|
|||||||
//Almacenate actual day on LocalStorage
|
//Almacenate actual day on LocalStorage
|
||||||
const actualDay = moment().format('DD-MM-YYYY')
|
const actualDay = moment().format('DD-MM-YYYY')
|
||||||
localStorage.setItem('lastDayPrices', actualDay)
|
localStorage.setItem('lastDayPrices', actualDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, [cryptosPrices])
|
}, [cryptosPrices])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user