diff --git a/src/components/common/image-stack/index.css b/src/components/common/image-stack/index.css new file mode 100644 index 0000000..f7957b1 --- /dev/null +++ b/src/components/common/image-stack/index.css @@ -0,0 +1,15 @@ +.image-stack { + position: relative; + overflow: hidden; +} + +.image-stack-child { + position: absolute; + transition: left 0.5s ease-in-out; +} + +.image-stack-child img { + border-radius: 50%; + box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.3); + transition: width 0.5s ease-in-out, height 0.5s ease-in-out; +} diff --git a/src/components/common/image-stack/index.tsx b/src/components/common/image-stack/index.tsx new file mode 100644 index 0000000..bb8d774 --- /dev/null +++ b/src/components/common/image-stack/index.tsx @@ -0,0 +1,53 @@ +import React, { useState } from "react"; +import "./index.css"; + +const ImageStack = ({ + imageSrcs, + imageWidth, + imageHeight, +}: { + imageSrcs: string[]; + imageWidth: number; + imageHeight: number; +}) => { + const [expanded, setExpanded] = useState(false); + + const handleMouseEnter = () => { + setExpanded(true); + }; + + const handleMouseLeave = () => { + setExpanded(false); + }; + + return ( +
+ {imageSrcs.map((image, index) => ( +
+ {`Image +
+ ))} +
+ ); +}; + +export default ImageStack; diff --git a/src/components/historical-data/index.tsx b/src/components/historical-data/index.tsx index 5abfcb8..eed9d89 100644 --- a/src/components/historical-data/index.tsx +++ b/src/components/historical-data/index.tsx @@ -21,6 +21,7 @@ import { downloadCoinLogos } from "../../middlelayers/data"; import { appCacheDir as getAppCacheDir } from "@tauri-apps/api/path"; import { convertFileSrc } from "@tauri-apps/api/tauri"; import { useWindowSize } from "../../utils/hook"; +import ImageStack from "../common/image-stack"; type RankData = { id: number; @@ -217,6 +218,23 @@ const App = ({ /> +
+ getImageApiPath(a.symbol)) + .value()} + imageWidth={25} + imageHeight={25} + /> +
{ - const filePath = `${appCacheDir}assets/coins/${d.symbol.toLowerCase()}.png`; - const apiPath = convertFileSrc(filePath); + const apiPath = getImageApiPath(d.symbol); return ( @@ -292,7 +314,10 @@ const App = ({ }} >

- {currency.symbol + prettyPriceNumberToLocaleString(currencyWrapper(currency)(d.price))} + {currency.symbol + + prettyPriceNumberToLocaleString( + currencyWrapper(currency)(d.price) + )}

@@ -366,7 +391,7 @@ const App = ({ @@ -374,7 +399,7 @@ const App = ({ @@ -382,7 +407,7 @@ const App = ({ - {detailPage(rankData)} + {renderDetailPage(rankData)}
diff --git a/src/components/overview/index.tsx b/src/components/overview/index.tsx index 6c554ef..745fbc2 100644 --- a/src/components/overview/index.tsx +++ b/src/components/overview/index.tsx @@ -24,7 +24,7 @@ const App = ({ topCoinsRankData, topCoinsPercentageChangeData, }: { - currency: CurrencyRateDetail, + currency: CurrencyRateDetail; totalValueData: { totalValue: number; changePercentage: number; @@ -43,7 +43,10 @@ const App = ({

- +