@@ -183,6 +340,7 @@ function Chart({
isCompare={isCompare}
profileNames={profileNames}
chartType={chartType?.toLowerCase()}
+ actions={actions}
>
{indicatorTitle}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/IndicatorTitle/index.js b/apps/climatemappedafrica/src/components/HURUmap/IndicatorTitle/index.js
deleted file mode 100644
index 4f02d1d2f..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/IndicatorTitle/index.js
+++ /dev/null
@@ -1,255 +0,0 @@
-import { RichTypography } from "@commons-ui/core";
-import { Action, Download, Share } from "@hurumap/core";
-import { Grid, useTheme } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
-import PropTypes from "prop-types";
-import React, { useState, useEffect } from "react";
-import * as vega from "vega";
-
-import { ReactComponent as DownloadIcon } from "@/climatemappedafrica/assets/icons/Component 1.svg";
-import { ReactComponent as ShareIcon } from "@/climatemappedafrica/assets/icons/Component 27.svg";
-import { ReactComponent as InfoIcon } from "@/climatemappedafrica/assets/icons/Component852.svg";
-import { ReactComponent as EmailIcon } from "@/climatemappedafrica/assets/icons/Email.svg";
-import { ReactComponent as FacebookIcon } from "@/climatemappedafrica/assets/icons/Facebook.svg";
-import { ReactComponent as CopyIcon } from "@/climatemappedafrica/assets/icons/Group 5062.svg";
-import { ReactComponent as LinkedInIcon } from "@/climatemappedafrica/assets/icons/LinkedIn.svg";
-import { ReactComponent as TwitterIcon } from "@/climatemappedafrica/assets/icons/Twitter.svg";
-import { ReactComponent as WhatsAppIcon } from "@/climatemappedafrica/assets/icons/WhatsApp.svg";
-import cfalogo from "@/climatemappedafrica/assets/logos/Group4462.svg";
-import projectlogo from "@/climatemappedafrica/assets/logos/Group5002.svg";
-import { idify } from "@/climatemappedafrica/components/HURUmap/Chart/utils";
-import config, { hurumapArgs } from "@/climatemappedafrica/config";
-import site from "@/climatemappedafrica/utils/site";
-
-const useStyles = makeStyles(({ breakpoints, typography, palette }) => ({
- root: {
- paddingTop: typography.pxToRem(24),
- paddingBottom: typography.pxToRem(25),
- },
- description: {
- fontSize: typography.pxToRem(11),
- lineHeight: 17 / 11,
- color: "#666666",
- padding: `${typography.pxToRem(18)} ${typography.pxToRem(
- 20,
- )} ${typography.pxToRem(31)} ${typography.pxToRem(16)}`,
- "& > p > span": {
- display: "inline-block",
- },
- },
- link: {
- color: palette.text.primary,
- fontSize: typography.pxToRem(13),
- lineHeight: 20 / 13,
- fontFamily: typography.body1.fontFamily,
- },
- action: {
- marginRight: typography.pxToRem(14),
- "&:last-of-type": {
- marginRight: 0,
- },
- },
- buttons: {
- justifyContent: "flex-start",
- marginTop: typography.pxToRem(20),
- marginBottom: typography.pxToRem(20),
- [breakpoints.up("md")]: {
- justifyContent: "flex-end",
- margin: 0,
- },
- },
-}));
-
-function IndicatorTitle({
- children,
- description,
- disableToggle,
- title,
- view,
- ...props
-}) {
- const [downloadView, setDownloadView] = useState(null);
-
- const classes = useStyles(props);
- const { palette } = useTheme();
-
- const {
- currentFilters,
- geoCode,
- indicatorId,
- isCompare,
- profileNames,
- spec,
- } = props;
-
- const url = new URL(
- `/embed/${geoCode.toLowerCase()}/${indicatorId}`,
- site.environmentUrl,
- ).toString();
- const className = `wrapper-${geoCode}-${indicatorId}`;
-
- const codeData = {
- className,
- src: `${process.env.NEXT_PUBLIC_APP_URL}/embed/${geoCode.toLowerCase()}/${indicatorId}`,
- };
-
- const shareData = [
- {
- name: "Facebook",
- icon: FacebookIcon,
- props: { quote: title, hashtag: "#ClimateMapped.Africa" },
- },
- {
- name: "Twitter",
- icon: TwitterIcon,
- props: { title, via: "Code4Africa", related: ["Code4Africa"] },
- },
- {
- name: "LinkedIn",
- icon: LinkedInIcon,
- props: {
- summary: title,
- source: process.env.NEXT_PUBLIC_APP_URL,
- },
- },
- { name: "WhatsApp", icon: WhatsAppIcon, props: { quote: title } },
- { name: "Email", icon: EmailIcon, props: { subject: title } },
- { name: "CopyUrl", icon: CopyIcon, props: { subject: title } },
- ];
-
- const {
- indicatorTitle: {
- download: { values, layouts, imageTypes, fileTypes },
- },
- } = hurumapArgs;
-
- const newFilters = currentFilters?.forEach(({ name, value }) => {
- const filterName = idify(name);
- view?.signal(`${filterName}Filter`, true);
- view?.signal(`${filterName}FilterValue`, value);
- });
-
- const splitString = (str) => {
- // eslint-disable-next-line prefer-regex-literals
- const regex = new RegExp(/\S.{1,42}\S(?= |$)/, "g");
- const chunks = str.match(regex);
- return chunks;
- };
-
- const chartTitle = splitString(title)?.slice(0, 3);
- const subtitle = currentFilters?.reduce((acc, cur) => {
- return `${acc}${cur.name}: ${cur.value},`;
- }, "");
- const secondaryName = isCompare
- ? ` vs ${profileNames?.secondary?.split("-")[0]}`
- : "";
- const chartSubtitle = `${subtitle} Location: ${profileNames?.primary}${secondaryName}`;
-
- const actions = [
- description && {
- id: "act-description",
- title: "Description",
- header: "Learn More",
- children: (
-
- {description}
-
- ),
- icon:
,
- },
- {
- id: "act-download",
- title: "Download",
- header: disableToggle ? "Download chart as" : "Chart value as:",
- children: (
-
- ),
- icon:
,
- },
- {
- id: "act-share",
- title: "Share",
- header: "Share chart via:",
- children: (
-
- ),
- icon:
,
- },
- ];
-
- useEffect(() => {
- try {
- const viewProp = new vega.View(vega.parse(spec), { renderer: "none" });
- setDownloadView(viewProp);
- } catch (error) {
- console.error("Error creating view", error);
- }
- }, [spec]);
-
- return (
-
-
-
- {children || title}
-
-
- {actions
- .filter((a) => a?.id)
- .map((act) => (
-
-
-
- ))}
-
-
-
- );
-}
-
-IndicatorTitle.propTypes = {
- children: PropTypes.node,
- description: PropTypes.string,
- disableToggle: PropTypes.bool,
- title: PropTypes.string,
- view: PropTypes.shape({
- height: PropTypes.func,
- data: PropTypes.func,
- }),
-};
-
-IndicatorTitle.defaultProps = {
- children: undefined,
- description: undefined,
- disableToggle: false,
- title: undefined,
- view: undefined,
-};
-
-export default IndicatorTitle;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/IndicatorTitle/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/IndicatorTitle/useStyles.js
deleted file mode 100644
index 429ec2f18..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/IndicatorTitle/useStyles.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ palette, typography }) => ({
- root: {},
- header: {
- background: palette.background.paper,
- display: "flex",
- alignItems: "center",
- paddingLeft: typography.pxToRem(16),
- justifyContent: "space-between",
- },
- layout: {
- display: "flex",
- alignItems: "center",
- paddingLeft: typography.pxToRem(16),
- border: `1px solid ${palette.grey.light}`,
- },
- row: {
- height: typography.pxToRem(36),
- },
- cell: {
- borderRight: `1px solid ${palette.background.paper}`,
- "&:last-of-type": {
- borderRight: 0,
- },
- },
- text: {
- fontSize: typography.pxToRem(11),
- lineHeight: 17 / 11,
- color: "#666666",
- },
- layoutButton: {
- padding: 0,
- },
- button: {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- borderRight: `1px solid ${palette.background.paper}`,
- "&:last-of-type": {
- borderRight: 0,
- },
- "&:hover": {
- background: palette.background.paper,
- border: `2px solid ${palette.grey.main}`,
- },
- },
- activeButton: {
- background: palette.background.paper,
- border: `2px solid ${palette.grey.main}`,
- },
- description: {
- fontSize: typography.pxToRem(11),
- lineHeight: 17 / 11,
- color: "#666666",
- padding: `${typography.pxToRem(18)} ${typography.pxToRem(
- 20,
- )} ${typography.pxToRem(31)} ${typography.pxToRem(16)}`,
- },
- code: {
- background: palette.background.paper,
- },
- shareButton: {
- backgroundColor: `${palette.background.default} !important`,
- filter: "opacity(0.6)",
- width: "100%",
- border: `solid 1px ${palette.background.paper} !important`,
- paddingTop: `${typography.pxToRem(5)} !important`,
- "&:hover": {
- border: "solid 1px #666666 !important",
- backgroundColor: `${palette.grey.light} !important`,
- },
- },
- icon: {},
- copyIcon: {
- marginLeft: typography.pxToRem(16),
- },
-}));
-
-export default useStyles;
From 475b55bdeb1a451414f03b622637518d9b43cf44 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 1 Aug 2024 14:00:32 +0300
Subject: [PATCH 13/18] delete unused component
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../HURUmap/IndicatorTitle/index.js | 255 ------------------
.../HURUmap/IndicatorTitle/useStyles.js | 80 ------
2 files changed, 335 deletions(-)
delete mode 100644 apps/pesayetu/src/components/HURUmap/IndicatorTitle/index.js
delete mode 100644 apps/pesayetu/src/components/HURUmap/IndicatorTitle/useStyles.js
diff --git a/apps/pesayetu/src/components/HURUmap/IndicatorTitle/index.js b/apps/pesayetu/src/components/HURUmap/IndicatorTitle/index.js
deleted file mode 100644
index bcbbcc5f8..000000000
--- a/apps/pesayetu/src/components/HURUmap/IndicatorTitle/index.js
+++ /dev/null
@@ -1,255 +0,0 @@
-import { RichTypography } from "@commons-ui/core";
-import { Action, Download, Share } from "@hurumap/core";
-import { Grid, useTheme } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
-import PropTypes from "prop-types";
-import React, { useState, useEffect } from "react";
-import * as vega from "vega";
-
-import { ReactComponent as DownloadIcon } from "@/pesayetu/assets/icons/Component 1.svg";
-import { ReactComponent as ShareIcon } from "@/pesayetu/assets/icons/Component 27.svg";
-import { ReactComponent as InfoIcon } from "@/pesayetu/assets/icons/Component852.svg";
-import { ReactComponent as EmailIcon } from "@/pesayetu/assets/icons/Email.svg";
-import { ReactComponent as FacebookIcon } from "@/pesayetu/assets/icons/Facebook.svg";
-import { ReactComponent as CopyIcon } from "@/pesayetu/assets/icons/Group 5062.svg";
-import { ReactComponent as LinkedInIcon } from "@/pesayetu/assets/icons/LinkedIn.svg";
-import { ReactComponent as TwitterIcon } from "@/pesayetu/assets/icons/Twitter.svg";
-import { ReactComponent as WhatsAppIcon } from "@/pesayetu/assets/icons/WhatsApp.svg";
-import cfalogo from "@/pesayetu/assets/logos/Group4462.svg";
-import projectlogo from "@/pesayetu/assets/logos/Group5002.svg";
-import { idify } from "@/pesayetu/components/HURUmap/Chart/utils";
-import config, { hurumapArgs } from "@/pesayetu/config";
-import site from "@/pesayetu/utils/site";
-
-const useStyles = makeStyles(({ breakpoints, typography, palette }) => ({
- root: {
- paddingTop: typography.pxToRem(24),
- paddingBottom: typography.pxToRem(25),
- },
- description: {
- fontSize: typography.pxToRem(11),
- lineHeight: 17 / 11,
- color: "#666666",
- padding: `${typography.pxToRem(18)} ${typography.pxToRem(
- 20,
- )} ${typography.pxToRem(31)} ${typography.pxToRem(16)}`,
- "& > p > span": {
- display: "inline-block",
- },
- },
- link: {
- color: palette.text.primary,
- fontSize: typography.pxToRem(13),
- lineHeight: 20 / 13,
- fontFamily: typography.body1.fontFamily,
- },
- action: {
- marginRight: typography.pxToRem(14),
- "&:last-of-type": {
- marginRight: 0,
- },
- },
- buttons: {
- justifyContent: "flex-start",
- marginTop: typography.pxToRem(20),
- marginBottom: typography.pxToRem(20),
- [breakpoints.up("md")]: {
- justifyContent: "flex-end",
- margin: 0,
- },
- },
-}));
-
-function IndicatorTitle({
- children,
- description,
- disableToggle,
- title,
- view,
- ...props
-}) {
- const [downloadView, setDownloadView] = useState(null);
-
- const classes = useStyles(props);
- const { palette } = useTheme();
-
- const {
- currentFilters,
- geoCode,
- indicatorId,
- isCompare,
- profileNames,
- spec,
- } = props;
-
- const url = new URL(
- `/embed/${geoCode.toLowerCase()}/${indicatorId}`,
- site.environmentUrl,
- ).toString();
- const className = `wrapper-${geoCode}-${indicatorId}`;
-
- const codeData = {
- className,
- src: `${process.env.NEXT_PUBLIC_APP_URL}/embed/${geoCode.toLowerCase()}/${indicatorId}`,
- };
-
- const shareData = [
- {
- name: "Facebook",
- icon: FacebookIcon,
- props: { quote: title, hashtag: "#ClimateMapped.Africa" },
- },
- {
- name: "Twitter",
- icon: TwitterIcon,
- props: { title, via: "Code4Africa", related: ["Code4Africa"] },
- },
- {
- name: "LinkedIn",
- icon: LinkedInIcon,
- props: {
- summary: title,
- source: process.env.NEXT_PUBLIC_APP_URL,
- },
- },
- { name: "WhatsApp", icon: WhatsAppIcon, props: { quote: title } },
- { name: "Email", icon: EmailIcon, props: { subject: title } },
- { name: "CopyUrl", icon: CopyIcon, props: { subject: title } },
- ];
-
- const {
- indicatorTitle: {
- download: { values, layouts, imageTypes, fileTypes },
- },
- } = hurumapArgs;
-
- const newFilters = currentFilters?.forEach(({ name, value }) => {
- const filterName = idify(name);
- view?.signal(`${filterName}Filter`, true);
- view?.signal(`${filterName}FilterValue`, value);
- });
-
- const splitString = (str) => {
- // eslint-disable-next-line prefer-regex-literals
- const regex = new RegExp(/\S.{1,42}\S(?= |$)/, "g");
- const chunks = str.match(regex);
- return chunks;
- };
-
- const chartTitle = splitString(title)?.slice(0, 3);
- const subtitle = currentFilters?.reduce((acc, cur) => {
- return `${acc}${cur.name}: ${cur.value},`;
- }, "");
- const secondaryName = isCompare
- ? ` vs ${profileNames?.secondary?.split("-")[0]}`
- : "";
- const chartSubtitle = `${subtitle} Location: ${profileNames?.primary}${secondaryName}`;
-
- const actions = [
- description && {
- id: "act-description",
- title: "Description",
- header: "Learn More",
- children: (
-
- {description}
-
- ),
- icon:
,
- },
- {
- id: "act-download",
- title: "Download",
- header: disableToggle ? "Download chart as" : "Chart value as:",
- children: (
-
- ),
- icon:
,
- },
- {
- id: "act-share",
- title: "Share",
- header: "Share chart via:",
- children: (
-
- ),
- icon:
,
- },
- ];
-
- useEffect(() => {
- try {
- const viewProp = new vega.View(vega.parse(spec), { renderer: "none" });
- setDownloadView(viewProp);
- } catch (error) {
- console.error("Error creating view", error);
- }
- }, [spec]);
-
- return (
-
-
-
- {children || title}
-
-
- {actions
- .filter((a) => a?.id)
- .map((act) => (
-
-
-
- ))}
-
-
-
- );
-}
-
-IndicatorTitle.propTypes = {
- children: PropTypes.node,
- description: PropTypes.string,
- disableToggle: PropTypes.bool,
- title: PropTypes.string,
- view: PropTypes.shape({
- height: PropTypes.func,
- data: PropTypes.func,
- }),
-};
-
-IndicatorTitle.defaultProps = {
- children: undefined,
- description: undefined,
- disableToggle: false,
- title: undefined,
- view: undefined,
-};
-
-export default IndicatorTitle;
diff --git a/apps/pesayetu/src/components/HURUmap/IndicatorTitle/useStyles.js b/apps/pesayetu/src/components/HURUmap/IndicatorTitle/useStyles.js
deleted file mode 100644
index 429ec2f18..000000000
--- a/apps/pesayetu/src/components/HURUmap/IndicatorTitle/useStyles.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ palette, typography }) => ({
- root: {},
- header: {
- background: palette.background.paper,
- display: "flex",
- alignItems: "center",
- paddingLeft: typography.pxToRem(16),
- justifyContent: "space-between",
- },
- layout: {
- display: "flex",
- alignItems: "center",
- paddingLeft: typography.pxToRem(16),
- border: `1px solid ${palette.grey.light}`,
- },
- row: {
- height: typography.pxToRem(36),
- },
- cell: {
- borderRight: `1px solid ${palette.background.paper}`,
- "&:last-of-type": {
- borderRight: 0,
- },
- },
- text: {
- fontSize: typography.pxToRem(11),
- lineHeight: 17 / 11,
- color: "#666666",
- },
- layoutButton: {
- padding: 0,
- },
- button: {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- borderRight: `1px solid ${palette.background.paper}`,
- "&:last-of-type": {
- borderRight: 0,
- },
- "&:hover": {
- background: palette.background.paper,
- border: `2px solid ${palette.grey.main}`,
- },
- },
- activeButton: {
- background: palette.background.paper,
- border: `2px solid ${palette.grey.main}`,
- },
- description: {
- fontSize: typography.pxToRem(11),
- lineHeight: 17 / 11,
- color: "#666666",
- padding: `${typography.pxToRem(18)} ${typography.pxToRem(
- 20,
- )} ${typography.pxToRem(31)} ${typography.pxToRem(16)}`,
- },
- code: {
- background: palette.background.paper,
- },
- shareButton: {
- backgroundColor: `${palette.background.default} !important`,
- filter: "opacity(0.6)",
- width: "100%",
- border: `solid 1px ${palette.background.paper} !important`,
- paddingTop: `${typography.pxToRem(5)} !important`,
- "&:hover": {
- border: "solid 1px #666666 !important",
- backgroundColor: `${palette.grey.light} !important`,
- },
- },
- icon: {},
- copyIcon: {
- marginLeft: typography.pxToRem(16),
- },
-}));
-
-export default useStyles;
From ca803d6f3b1966e405ee7051c8226c28345b4797 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 1 Aug 2024 14:18:38 +0300
Subject: [PATCH 14/18] Move button component
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../HURUmap/core/ShareButton.stories.js | 51 -------------------
packages/hurumap-core/src/Share/Share.js | 2 +-
.../src/{ShareButton => Share}/ShareButton.js | 0
.../ShareButton.snap.js | 0
.../ShareButton.test.js | 0
.../hurumap-core/src/ShareButton/index.js | 3 --
packages/hurumap-core/src/index.js | 1 -
7 files changed, 1 insertion(+), 56 deletions(-)
delete mode 100644 apps/uibook/stories/HURUmap/core/ShareButton.stories.js
rename packages/hurumap-core/src/{ShareButton => Share}/ShareButton.js (100%)
rename packages/hurumap-core/src/{ShareButton => Share}/ShareButton.snap.js (100%)
rename packages/hurumap-core/src/{ShareButton => Share}/ShareButton.test.js (100%)
delete mode 100644 packages/hurumap-core/src/ShareButton/index.js
diff --git a/apps/uibook/stories/HURUmap/core/ShareButton.stories.js b/apps/uibook/stories/HURUmap/core/ShareButton.stories.js
deleted file mode 100644
index 817d6f063..000000000
--- a/apps/uibook/stories/HURUmap/core/ShareButton.stories.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import { ShareButton } from "@hurumap/core";
-import EmailIcon from "@mui/icons-material/Email";
-import FacebookIcon from "@mui/icons-material/Facebook";
-import LinkedInIcon from "@mui/icons-material/LinkedIn";
-import PinterestIcon from "@mui/icons-material/Pinterest";
-import TelegramIcon from "@mui/icons-material/Telegram";
-import WhatsAppIcon from "@mui/icons-material/WhatsApp";
-import XIcon from "@mui/icons-material/X";
-import React from "react";
-
-export default {
- title: "@hurumap/core/ShareButton",
- argTypes: {
- name: {
- control: {
- type: "select",
- },
- options: [
- "Facebook",
- "Twitter",
- "LinkedIn",
- "WhatsApp",
- "Email",
- "Telegram",
- "Pinterest",
- ],
- },
- },
-};
-
-const iconMapping = {
- Facebook: FacebookIcon,
- Twitter: XIcon,
- LinkedIn: LinkedInIcon,
- WhatsApp: WhatsAppIcon,
- Email: EmailIcon,
- Telegram: TelegramIcon,
- Pinterest: PinterestIcon,
-};
-
-function Template({ name, ...args }) {
- const IconComponent = iconMapping[name];
- return
;
-}
-
-export const Default = Template.bind({});
-
-Default.args = {
- url: "https://codeforafrica.org",
- name: "Facebook",
-};
diff --git a/packages/hurumap-core/src/Share/Share.js b/packages/hurumap-core/src/Share/Share.js
index 6aae3dce6..dce5caa2a 100644
--- a/packages/hurumap-core/src/Share/Share.js
+++ b/packages/hurumap-core/src/Share/Share.js
@@ -1,7 +1,7 @@
import { Grid, TextField, Typography, useTheme } from "@mui/material";
import React, { useState, useEffect } from "react";
-import ShareButton from "@/hurumap/core/ShareButton";
+import ShareButton from "./ShareButton";
const Share = React.forwardRef(function Share(
{
diff --git a/packages/hurumap-core/src/ShareButton/ShareButton.js b/packages/hurumap-core/src/Share/ShareButton.js
similarity index 100%
rename from packages/hurumap-core/src/ShareButton/ShareButton.js
rename to packages/hurumap-core/src/Share/ShareButton.js
diff --git a/packages/hurumap-core/src/ShareButton/ShareButton.snap.js b/packages/hurumap-core/src/Share/ShareButton.snap.js
similarity index 100%
rename from packages/hurumap-core/src/ShareButton/ShareButton.snap.js
rename to packages/hurumap-core/src/Share/ShareButton.snap.js
diff --git a/packages/hurumap-core/src/ShareButton/ShareButton.test.js b/packages/hurumap-core/src/Share/ShareButton.test.js
similarity index 100%
rename from packages/hurumap-core/src/ShareButton/ShareButton.test.js
rename to packages/hurumap-core/src/Share/ShareButton.test.js
diff --git a/packages/hurumap-core/src/ShareButton/index.js b/packages/hurumap-core/src/ShareButton/index.js
deleted file mode 100644
index 0b9ed88f1..000000000
--- a/packages/hurumap-core/src/ShareButton/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import ShareButton from "./ShareButton";
-
-export default ShareButton;
diff --git a/packages/hurumap-core/src/index.js b/packages/hurumap-core/src/index.js
index 3ed6ac8c4..8b4eef3c0 100644
--- a/packages/hurumap-core/src/index.js
+++ b/packages/hurumap-core/src/index.js
@@ -5,7 +5,6 @@ export { default as LocationHighlight } from "./LocationHighlight";
export { default as Location } from "./Location";
export { default as IndicatorTitle } from "./IndicatorTitle";
export { default as Scope } from "./Scope";
-export { default as ShareButton } from "./ShareButton";
export { default as Share } from "./Share";
export { default as Action } from "./Action";
export { default as Download } from "./Download";
From 09afdc8882895f3a91fe61cf0015630558e3d237 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 1 Aug 2024 14:25:22 +0300
Subject: [PATCH 15/18] Add tests
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../src/IndicatorTitle/IndicatorTitle.snap.js | 28 +++++++++++++++++++
.../src/IndicatorTitle/IndicatorTitle.test.js | 19 +++++++++++++
2 files changed, 47 insertions(+)
create mode 100644 packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.snap.js
create mode 100644 packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.test.js
diff --git a/packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.snap.js b/packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.snap.js
new file mode 100644
index 000000000..a81eb3f2b
--- /dev/null
+++ b/packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.snap.js
@@ -0,0 +1,28 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`IndicatorTitle renders unchanged 1`] = `
+
+`;
diff --git a/packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.test.js b/packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.test.js
new file mode 100644
index 000000000..b4a97ce9c
--- /dev/null
+++ b/packages/hurumap-core/src/IndicatorTitle/IndicatorTitle.test.js
@@ -0,0 +1,19 @@
+import { render } from "@commons-ui/testing-library";
+import React from "react";
+
+import IndicatorTitle from "./IndicatorTitle";
+
+const defaultProps = {
+ children:
Children
,
+ description: "Description",
+ title: "Title",
+ view: {},
+ actions: [],
+};
+
+describe("IndicatorTitle", () => {
+ it("renders unchanged", () => {
+ const { container } = render(
);
+ expect(container).toMatchSnapshot();
+ });
+});
From 92482bbd0bdf55e72d13300253f863c1824200c8 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 1 Aug 2024 15:14:22 +0300
Subject: [PATCH 16/18] Remove unused assets
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
packages/hurumap-core/src/assets/Email.svg | 1 -
packages/hurumap-core/src/assets/Facebook.svg | 1 -
.../hurumap-core/src/assets/Group4462.svg | 1 -
.../hurumap-core/src/assets/Group5002.svg | 9 ---------
packages/hurumap-core/src/assets/Group922.svg | 19 -------------------
packages/hurumap-core/src/assets/Group923.svg | 19 -------------------
packages/hurumap-core/src/assets/LinkedIn.svg | 1 -
packages/hurumap-core/src/assets/Twitter.svg | 1 -
packages/hurumap-core/src/assets/WhatsApp.svg | 1 -
9 files changed, 53 deletions(-)
delete mode 100644 packages/hurumap-core/src/assets/Email.svg
delete mode 100644 packages/hurumap-core/src/assets/Facebook.svg
delete mode 100644 packages/hurumap-core/src/assets/Group4462.svg
delete mode 100644 packages/hurumap-core/src/assets/Group5002.svg
delete mode 100644 packages/hurumap-core/src/assets/Group922.svg
delete mode 100644 packages/hurumap-core/src/assets/Group923.svg
delete mode 100644 packages/hurumap-core/src/assets/LinkedIn.svg
delete mode 100644 packages/hurumap-core/src/assets/Twitter.svg
delete mode 100644 packages/hurumap-core/src/assets/WhatsApp.svg
diff --git a/packages/hurumap-core/src/assets/Email.svg b/packages/hurumap-core/src/assets/Email.svg
deleted file mode 100644
index 3e44b8779..000000000
--- a/packages/hurumap-core/src/assets/Email.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/hurumap-core/src/assets/Facebook.svg b/packages/hurumap-core/src/assets/Facebook.svg
deleted file mode 100644
index 56c40db42..000000000
--- a/packages/hurumap-core/src/assets/Facebook.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/hurumap-core/src/assets/Group4462.svg b/packages/hurumap-core/src/assets/Group4462.svg
deleted file mode 100644
index 277cf32a8..000000000
--- a/packages/hurumap-core/src/assets/Group4462.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/hurumap-core/src/assets/Group5002.svg b/packages/hurumap-core/src/assets/Group5002.svg
deleted file mode 100644
index 511d34de6..000000000
--- a/packages/hurumap-core/src/assets/Group5002.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/packages/hurumap-core/src/assets/Group922.svg b/packages/hurumap-core/src/assets/Group922.svg
deleted file mode 100644
index d5d131c3b..000000000
--- a/packages/hurumap-core/src/assets/Group922.svg
+++ /dev/null
@@ -1,19 +0,0 @@
-
diff --git a/packages/hurumap-core/src/assets/Group923.svg b/packages/hurumap-core/src/assets/Group923.svg
deleted file mode 100644
index 82ecb1b26..000000000
--- a/packages/hurumap-core/src/assets/Group923.svg
+++ /dev/null
@@ -1,19 +0,0 @@
-
diff --git a/packages/hurumap-core/src/assets/LinkedIn.svg b/packages/hurumap-core/src/assets/LinkedIn.svg
deleted file mode 100644
index 744718823..000000000
--- a/packages/hurumap-core/src/assets/LinkedIn.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/hurumap-core/src/assets/Twitter.svg b/packages/hurumap-core/src/assets/Twitter.svg
deleted file mode 100644
index ebef26dec..000000000
--- a/packages/hurumap-core/src/assets/Twitter.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/hurumap-core/src/assets/WhatsApp.svg b/packages/hurumap-core/src/assets/WhatsApp.svg
deleted file mode 100644
index 85385c727..000000000
--- a/packages/hurumap-core/src/assets/WhatsApp.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
From b176ac65a41d79ef4a6ce299b7f7828e3c08a0f3 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 1 Aug 2024 17:52:58 +0300
Subject: [PATCH 17/18] Fix stories
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../src/components/HURUmap/Chart/index.js | 2 +-
.../stories/hurumap/core/Download.stories.js | 7 ++-
.../hurumap/core/IndicatorTitle.stories.js | 47 +++++++++++++++++++
3 files changed, 53 insertions(+), 3 deletions(-)
create mode 100644 apps/uibook/stories/hurumap/core/IndicatorTitle.stories.js
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
index f8deed06b..470218447 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
@@ -104,7 +104,7 @@ function Chart({
setView(newView.view);
} catch (error) {
- console.error(error);
+ console.error("Error rendering chart", error);
}
}
}
diff --git a/apps/uibook/stories/hurumap/core/Download.stories.js b/apps/uibook/stories/hurumap/core/Download.stories.js
index 40c8054fd..356cb61b2 100644
--- a/apps/uibook/stories/hurumap/core/Download.stories.js
+++ b/apps/uibook/stories/hurumap/core/Download.stories.js
@@ -25,8 +25,8 @@ Default.args = {
handleChartValueChange: () => {},
height: 100,
isAction: true,
- imageTypes: ["PNG", "JPEG", "SVG"],
- layouts: ["Default"],
+ imageTypes: ["PNG", "SVG"],
+ layouts: ["Layout 1", "Layout 2"],
projectlogo: null,
profileNames: [],
scaleFactor: 2,
@@ -35,4 +35,7 @@ Default.args = {
title: "Download",
values: [],
view: null,
+ sx: {
+ width: 200,
+ },
};
diff --git a/apps/uibook/stories/hurumap/core/IndicatorTitle.stories.js b/apps/uibook/stories/hurumap/core/IndicatorTitle.stories.js
new file mode 100644
index 000000000..7a40aac8c
--- /dev/null
+++ b/apps/uibook/stories/hurumap/core/IndicatorTitle.stories.js
@@ -0,0 +1,47 @@
+import { IndicatorTitle } from "@hurumap/core";
+import DownloadIcon from "@mui/icons-material/Download";
+import InfoIcon from "@mui/icons-material/Info";
+import ShareIcon from "@mui/icons-material/Share";
+import React from "react";
+
+export default {
+ title: "@hurumap/core/IndicatorTitle",
+ component: IndicatorTitle,
+};
+
+function Template(args) {
+ return
;
+}
+
+export const Default = Template.bind({});
+
+Default.args = {
+ children:
Area of agricultural land in hectares,
+ description: "Area of agricultural land by main purpose is in Hectares.",
+ disableToggle: false,
+ title: "Area of agricultural land in hectares",
+ view: {},
+ actions: [
+ {
+ id: "act-description",
+ title: "Description",
+ header: "Learn More",
+ children:
Learn More,
+ icon:
,
+ },
+ {
+ id: "act-download",
+ title: "Download",
+ header: "Download",
+ children:
Download,
+ icon:
,
+ },
+ {
+ id: "act-share",
+ title: "Share",
+ header: "Share",
+ children:
Share,
+ icon:
,
+ },
+ ],
+};
From 2901835a4e211d09b217236080aa4b50e8a49f46 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Mon, 5 Aug 2024 10:54:53 +0300
Subject: [PATCH 18/18] Remove unused file
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
packages/hurumap-core/src/utils/utils.js | 8 --------
1 file changed, 8 deletions(-)
delete mode 100644 packages/hurumap-core/src/utils/utils.js
diff --git a/packages/hurumap-core/src/utils/utils.js b/packages/hurumap-core/src/utils/utils.js
deleted file mode 100644
index be0107532..000000000
--- a/packages/hurumap-core/src/utils/utils.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/* eslint-disable import/prefer-default-export */
-export function idify(string) {
- return string
- .replace(/^\s+|\s+$/g, "")
- .replace(/[^a-z0-9]/g, "")
- .replace(/\s+/g, "_")
- .replace(/_+/g, "_");
-}