From dde32f737a6397373e826723c3d7b0789fe71ee4 Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 26 Dec 2022 17:58:27 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=86=D1=83=20=D0=BA=D0=B0=D1=80=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/images/pages/deposit/ClusterMapIcon.tsx | 49 +++++++++++++++++++ src/images/pages/deposit/MapPointer.svg | 3 ++ src/images/pages/deposit/WellMapIcon.svg | 10 ++++ .../components/icons/cluster-map-icon.less | 6 +++ 4 files changed, 68 insertions(+) create mode 100644 src/images/pages/deposit/ClusterMapIcon.tsx create mode 100644 src/images/pages/deposit/MapPointer.svg create mode 100644 src/images/pages/deposit/WellMapIcon.svg create mode 100644 src/styles/components/icons/cluster-map-icon.less diff --git a/src/images/pages/deposit/ClusterMapIcon.tsx b/src/images/pages/deposit/ClusterMapIcon.tsx new file mode 100644 index 0000000..5176fb7 --- /dev/null +++ b/src/images/pages/deposit/ClusterMapIcon.tsx @@ -0,0 +1,49 @@ +import { memo, useMemo } from 'react' + +import '@styles/components/icons/cluster-map-icon.less' + +export type ClusterMapIconProps = { + width?: number | string + height?: number | string + count?: number + showBadge?: boolean +} + +const defaultWidth = 65 +const defaultHeight = 73 +const ratio = defaultWidth / defaultHeight + +export const ClusterMapIcon = memo(({ width, height, count, showBadge }) => { + const { w, h } = useMemo(() => { + const hasW = typeof width !== 'undefined' && width !== null + const hasH = typeof height !== 'undefined' && height !== null + const out: Record = { w: defaultWidth, h: defaultHeight } + if (hasW) out.w = width + else if (typeof height === 'number') out.w = height / ratio + if (hasH) out.h = height + else if (typeof width === 'number') out.h = width * ratio + return out + }, [width, height]) + + return ( + + + + + + + + + + + {typeof count === 'number' && ( + {count} + )} + {showBadge && ( + + )} + + ) +}) + +export default ClusterMapIcon diff --git a/src/images/pages/deposit/MapPointer.svg b/src/images/pages/deposit/MapPointer.svg new file mode 100644 index 0000000..e390deb --- /dev/null +++ b/src/images/pages/deposit/MapPointer.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/images/pages/deposit/WellMapIcon.svg b/src/images/pages/deposit/WellMapIcon.svg new file mode 100644 index 0000000..7e49158 --- /dev/null +++ b/src/images/pages/deposit/WellMapIcon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/styles/components/icons/cluster-map-icon.less b/src/styles/components/icons/cluster-map-icon.less new file mode 100644 index 0000000..d664262 --- /dev/null +++ b/src/styles/components/icons/cluster-map-icon.less @@ -0,0 +1,6 @@ +.dd-cluster-map-icon { + & .dd-cluster-map-icon-count { + font-size: 22px; + font-weight: 700; + } +}