From 9dc0cf02d9c7e1d3e0c5a8c7e34e0945399816a4 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:54:11 +0300 Subject: [PATCH 1/8] Move Source --- .../src/components/HURUmap/Chart/index.js | 14 +++--- .../src/components/HURUmap/KeyMetric/index.js | 10 ++-- .../components/HURUmap/KeyMetric/useStyles.js | 3 -- .../src/components/HURUmap/Chart/index.js | 14 +++--- .../src/components/HURUmap/KeyMetric/index.js | 10 ++-- .../components/HURUmap/KeyMetric/useStyles.js | 3 -- packages/hurumap-core/package.json | 3 +- packages/hurumap-core/src/Source/Source.js | 50 +++++++++++++++++++ packages/hurumap-core/src/Source/index.js | 3 ++ packages/hurumap-core/src/index.js | 1 + pnpm-lock.yaml | 9 ++-- 11 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 packages/hurumap-core/src/Source/Source.js create mode 100644 packages/hurumap-core/src/Source/index.js diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js index 2ecc33ebe..fbce581c3 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/core"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; @@ -12,10 +13,9 @@ import { calculateTooltipPosition, idify } from "./utils"; import ChartTooltip from "@/climatemappedafrica/components/HURUmap/ChartTooltip"; import IndicatorTitle from "@/climatemappedafrica/components/HURUmap/IndicatorTitle"; -import Source from "@/climatemappedafrica/components/HURUmap/Source"; import theme from "@/climatemappedafrica/theme"; -const useStyles = makeStyles(({ typography }) => ({ +const useStyles = makeStyles(() => ({ root: { position: "relative", width: "100%", @@ -23,9 +23,6 @@ const useStyles = makeStyles(({ typography }) => ({ chart: { width: "100%", }, - source: { - margin: `${typography.pxToRem(20)} 0`, - }, })); function Chart({ @@ -242,7 +239,12 @@ function Chart({ /> )}
- + ({ + margin: `${typography.pxToRem(20)} 0`, + })} + > {source}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js index 3f0d89c15..4c93eba4d 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/core"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; @@ -5,8 +6,6 @@ import React from "react"; import useStyles from "./useStyles"; -import Source from "@/climatemappedafrica/components/HURUmap/Source"; - function KeyMetric({ className, formattedValue: formattedValueProp, @@ -67,7 +66,12 @@ function KeyMetric({ {parentValue} )} - + ({ + margin: `${theme.typography.pxToRem(20)} 0`, + })} + > {source} diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js index 9f6f0fd4f..035b5d260 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js @@ -19,9 +19,6 @@ const useStyles = makeStyles(({ typography, palette }) => ({ progressBarDeterminate: { backgroundColor: palette.grey.main, }, - source: { - marginTop: typography.pxToRem(10), - }, text: { fontSize: typography.pxToRem(11), }, diff --git a/apps/pesayetu/src/components/HURUmap/Chart/index.js b/apps/pesayetu/src/components/HURUmap/Chart/index.js index 0aaa02790..e5a8d5359 100644 --- a/apps/pesayetu/src/components/HURUmap/Chart/index.js +++ b/apps/pesayetu/src/components/HURUmap/Chart/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/core"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; @@ -12,10 +13,9 @@ import { calculateTooltipPosition, idify } from "./utils"; import ChartTooltip from "@/pesayetu/components/HURUmap/ChartTooltip"; import IndicatorTitle from "@/pesayetu/components/HURUmap/IndicatorTitle"; -import Source from "@/pesayetu/components/HURUmap/Source"; import theme from "@/pesayetu/theme"; -const useStyles = makeStyles(({ typography }) => ({ +const useStyles = makeStyles(() => ({ root: { position: "relative", width: "100%", @@ -23,9 +23,6 @@ const useStyles = makeStyles(({ typography }) => ({ chart: { width: "100%", }, - source: { - margin: `${typography.pxToRem(20)} 0`, - }, })); function Chart({ @@ -239,7 +236,12 @@ function Chart({ /> )}
- + ({ + margin: `${typography.pxToRem(20)} 0`, + })} + > {source}
diff --git a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js index dee89f430..4c93eba4d 100644 --- a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js +++ b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/core"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; @@ -5,8 +6,6 @@ import React from "react"; import useStyles from "./useStyles"; -import Source from "@/pesayetu/components/HURUmap/Source"; - function KeyMetric({ className, formattedValue: formattedValueProp, @@ -67,7 +66,12 @@ function KeyMetric({ {parentValue} )} - + ({ + margin: `${theme.typography.pxToRem(20)} 0`, + })} + > {source} diff --git a/apps/pesayetu/src/components/HURUmap/KeyMetric/useStyles.js b/apps/pesayetu/src/components/HURUmap/KeyMetric/useStyles.js index 9f6f0fd4f..035b5d260 100644 --- a/apps/pesayetu/src/components/HURUmap/KeyMetric/useStyles.js +++ b/apps/pesayetu/src/components/HURUmap/KeyMetric/useStyles.js @@ -19,9 +19,6 @@ const useStyles = makeStyles(({ typography, palette }) => ({ progressBarDeterminate: { backgroundColor: palette.grey.main, }, - source: { - marginTop: typography.pxToRem(10), - }, text: { fontSize: typography.pxToRem(11), }, diff --git a/packages/hurumap-core/package.json b/packages/hurumap-core/package.json index 065a55347..bf78fbf62 100644 --- a/packages/hurumap-core/package.json +++ b/packages/hurumap-core/package.json @@ -67,6 +67,7 @@ "react-leaflet": "^4.2.1" }, "dependencies": { - "prop-types": "^15.8.1" + "prop-types": "^15.8.1", + "@commons-ui/next": "workspace:*" } } diff --git a/packages/hurumap-core/src/Source/Source.js b/packages/hurumap-core/src/Source/Source.js new file mode 100644 index 000000000..034b266e7 --- /dev/null +++ b/packages/hurumap-core/src/Source/Source.js @@ -0,0 +1,50 @@ +import { Link } from "@commons-ui/next"; +import { Typography } from "@mui/material"; +import React from "react"; + +const Source = React.forwardRef(function Source({ + children, + href, + title = "Source", + TitleTypographyProps, + LinkProps, + ...props +}) { + if (!(href && children)) { + return null; + } + return ( +
+ ({ + fontSize: theme.typography.pxToRem(13), + lineHeight: 20 / 13, + color: "#666666", + display: "inline-flex", + fontWeight: 500, + ...TitleTypographyProps?.sx, + })} + > + {title}:  + + ({ + color: theme.palette.text.primary, + fontSize: theme.typography.pxToRem(13), + lineHeight: 20 / 13, + fontFamily: theme.typography.body1.fontFamily, + fontWeight: 500, + ...LinkProps?.sx, + })} + > + {children} + +
+ ); +}); + +export default Source; diff --git a/packages/hurumap-core/src/Source/index.js b/packages/hurumap-core/src/Source/index.js new file mode 100644 index 000000000..785b7312e --- /dev/null +++ b/packages/hurumap-core/src/Source/index.js @@ -0,0 +1,3 @@ +import Source from "./Source"; + +export default Source; diff --git a/packages/hurumap-core/src/index.js b/packages/hurumap-core/src/index.js index 881ae0422..58324d503 100644 --- a/packages/hurumap-core/src/index.js +++ b/packages/hurumap-core/src/index.js @@ -1,3 +1,4 @@ /* eslint-disable import/prefer-default-export */ export { default as LocationTag } from "./LocationTag"; export { default as LocationHighlight } from "./LocationHighlight"; +export { default as Source } from "./Source"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f61147e1c..1155fdc98 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1001,7 +1001,7 @@ importers: version: 5.0.0-alpha.0(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(formik@2.4.6(react@18.3.1))(react@18.3.1)(tiny-warning@1.0.3) formik-mui-lab: specifier: ^1.0.0 - version: 1.0.0(uwokqjev6b7ignvfnuri4yvwiy) + version: 1.0.0(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/lab@5.0.0-alpha.155(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(formik@2.4.6(react@18.3.1))(react@18.3.1)(tiny-warning@1.0.3) jwt-decode: specifier: ^4.0.0 version: 4.0.0 @@ -1760,6 +1760,9 @@ importers: packages/hurumap-core: dependencies: + '@commons-ui/next': + specifier: workspace:* + version: link:../commons-ui-next prop-types: specifier: ^15.8.1 version: 15.8.1 @@ -23087,8 +23090,8 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 - formik-mui-lab@1.0.0(uwokqjev6b7ignvfnuri4yvwiy): - dependencies: + ? formik-mui-lab@1.0.0(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/lab@5.0.0-alpha.155(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(formik@2.4.6(react@18.3.1))(react@18.3.1)(tiny-warning@1.0.3) + : dependencies: '@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1) '@emotion/styled': 11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1) '@mui/lab': 5.0.0-alpha.155(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) From f1c1a485cb59a259cdd60ea60399f36f5724da47 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 11:00:59 +0300 Subject: [PATCH 2/8] Add storybook Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> --- .../stories/HURUmap/core/Source.stories.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 apps/uibook/stories/HURUmap/core/Source.stories.js diff --git a/apps/uibook/stories/HURUmap/core/Source.stories.js b/apps/uibook/stories/HURUmap/core/Source.stories.js new file mode 100644 index 000000000..1d18b0150 --- /dev/null +++ b/apps/uibook/stories/HURUmap/core/Source.stories.js @@ -0,0 +1,29 @@ +import { Source } from "@hurumap/core"; +import React from "react"; + +export default { + title: "@hurumap/core/Source", + argTypes: { + children: { + control: { + type: "text", + }, + }, + href: { + control: { + type: "text", + }, + }, + }, +}; + +function Template({ ...args }) { + return ; +} + +export const Default = Template.bind({}); + +Default.args = { + children: "Source Name", + href: "Source Url", +}; From 02b38a1c106585f2d25f21307a1e10b5236c3b27 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:29:34 +0300 Subject: [PATCH 3/8] use hurumap/next --- apps/climatemappedafrica/package.json | 1 + .../src/components/HURUmap/Chart/index.js | 2 +- .../src/components/HURUmap/KeyMetric/index.js | 2 +- apps/pesayetu/package.json | 1 + .../src/components/HURUmap/Chart/index.js | 2 +- .../src/components/HURUmap/KeyMetric/index.js | 2 +- apps/uibook/package.json | 1 + .../HURUmap/{core => next}/Source.stories.js | 12 +++- packages/hurumap-core/package.json | 2 +- packages/hurumap-core/src/index.js | 1 - packages/hurumap-next/.eslintignore | 29 ++++++++ packages/hurumap-next/.eslintrc.js | 4 ++ packages/hurumap-next/.lintstagedrc.js | 1 + packages/hurumap-next/CHANGELOG.md | 19 +++++ packages/hurumap-next/jest.config.js | 13 ++++ packages/hurumap-next/jest.setup.js | 12 ++++ packages/hurumap-next/jsconfig.json | 9 +++ packages/hurumap-next/package.json | 66 +++++++++++++++++ .../src/Source/Source.js | 21 +++--- .../hurumap-next/src/Source/Source.snap.js | 22 ++++++ .../hurumap-next/src/Source/Source.test.js | 15 ++++ .../src/Source/index.js | 0 packages/hurumap-next/src/index.js | 2 + pnpm-lock.yaml | 70 +++++++++++++++++++ 24 files changed, 291 insertions(+), 18 deletions(-) rename apps/uibook/stories/HURUmap/{core => next}/Source.stories.js (65%) create mode 100644 packages/hurumap-next/.eslintignore create mode 100644 packages/hurumap-next/.eslintrc.js create mode 100644 packages/hurumap-next/.lintstagedrc.js create mode 100644 packages/hurumap-next/CHANGELOG.md create mode 100644 packages/hurumap-next/jest.config.js create mode 100644 packages/hurumap-next/jest.setup.js create mode 100644 packages/hurumap-next/jsconfig.json create mode 100644 packages/hurumap-next/package.json rename packages/{hurumap-core => hurumap-next}/src/Source/Source.js (82%) create mode 100644 packages/hurumap-next/src/Source/Source.snap.js create mode 100644 packages/hurumap-next/src/Source/Source.test.js rename packages/{hurumap-core => hurumap-next}/src/Source/index.js (100%) create mode 100644 packages/hurumap-next/src/index.js diff --git a/apps/climatemappedafrica/package.json b/apps/climatemappedafrica/package.json index 722d0d1ac..d4760e94f 100644 --- a/apps/climatemappedafrica/package.json +++ b/apps/climatemappedafrica/package.json @@ -37,6 +37,7 @@ "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@hurumap/core": "workspace:*", + "@hurumap/next": "workspace:*", "@mui/lab": "5.0.0-alpha.155", "@mui/material": "^5.16.1", "@mui/styles": "^5.16.1", diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js index fbce581c3..c818dacf8 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js @@ -1,4 +1,4 @@ -import { Source } from "@hurumap/core"; +import { Source } from "@hurumap/next"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js index 4c93eba4d..49d6a2712 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js @@ -1,4 +1,4 @@ -import { Source } from "@hurumap/core"; +import { Source } from "@hurumap/next"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; diff --git a/apps/pesayetu/package.json b/apps/pesayetu/package.json index 716b19588..fa667a0c7 100644 --- a/apps/pesayetu/package.json +++ b/apps/pesayetu/package.json @@ -38,6 +38,7 @@ "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@hurumap/core": "workspace:*", + "@hurumap/next": "workspace:*", "@mui/lab": "5.0.0-alpha.155", "@mui/material": "^5.16.1", "@mui/styles": "^5.16.1", diff --git a/apps/pesayetu/src/components/HURUmap/Chart/index.js b/apps/pesayetu/src/components/HURUmap/Chart/index.js index e5a8d5359..903460bba 100644 --- a/apps/pesayetu/src/components/HURUmap/Chart/index.js +++ b/apps/pesayetu/src/components/HURUmap/Chart/index.js @@ -1,4 +1,4 @@ -import { Source } from "@hurumap/core"; +import { Source } from "@hurumap/next"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; diff --git a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js index 4c93eba4d..49d6a2712 100644 --- a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js +++ b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js @@ -1,4 +1,4 @@ -import { Source } from "@hurumap/core"; +import { Source } from "@hurumap/next"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; diff --git a/apps/uibook/package.json b/apps/uibook/package.json index 4c4684f07..e4dd82925 100644 --- a/apps/uibook/package.json +++ b/apps/uibook/package.json @@ -35,6 +35,7 @@ "@emotion/server": "^11.11.0", "@emotion/styled": "^11.11.5", "@hurumap/core": "workspace:*", + "@hurumap/next": "workspace:*", "@mui/material": "^5.16.1", "@mui/utils": "^5.16.1", "@next/env": "^14.2.5", diff --git a/apps/uibook/stories/HURUmap/core/Source.stories.js b/apps/uibook/stories/HURUmap/next/Source.stories.js similarity index 65% rename from apps/uibook/stories/HURUmap/core/Source.stories.js rename to apps/uibook/stories/HURUmap/next/Source.stories.js index 1d18b0150..4d10024d0 100644 --- a/apps/uibook/stories/HURUmap/core/Source.stories.js +++ b/apps/uibook/stories/HURUmap/next/Source.stories.js @@ -1,8 +1,8 @@ -import { Source } from "@hurumap/core"; +import { Source } from "@hurumap/next"; import React from "react"; export default { - title: "@hurumap/core/Source", + title: "@hurumap/next/Source", argTypes: { children: { control: { @@ -14,6 +14,11 @@ export default { type: "text", }, }, + title: { + control: { + type: "text", + }, + }, }, }; @@ -25,5 +30,6 @@ export const Default = Template.bind({}); Default.args = { children: "Source Name", - href: "Source Url", + href: "https://example.com", + title: "Source", }; diff --git a/packages/hurumap-core/package.json b/packages/hurumap-core/package.json index bf78fbf62..6cd44cc5c 100644 --- a/packages/hurumap-core/package.json +++ b/packages/hurumap-core/package.json @@ -18,7 +18,7 @@ "repository": { "type": "git", "url": "https://github.com/codeforafrica/ui.git", - "directory": "packages/commons-ui-core" + "directory": "packages/hurumap-core" }, "license": "MIT", "bugs": { diff --git a/packages/hurumap-core/src/index.js b/packages/hurumap-core/src/index.js index 58324d503..881ae0422 100644 --- a/packages/hurumap-core/src/index.js +++ b/packages/hurumap-core/src/index.js @@ -1,4 +1,3 @@ /* eslint-disable import/prefer-default-export */ export { default as LocationTag } from "./LocationTag"; export { default as LocationHighlight } from "./LocationHighlight"; -export { default as Source } from "./Source"; diff --git a/packages/hurumap-next/.eslintignore b/packages/hurumap-next/.eslintignore new file mode 100644 index 000000000..c0e426719 --- /dev/null +++ b/packages/hurumap-next/.eslintignore @@ -0,0 +1,29 @@ +# dependencies +node_modules +.pnp +.pnp.js +.pnpm-debug.log + +# testing +coverage + +# next.js +.next/ +out/ +build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Vercel +.vercel +.now + +# turbo +.turbo diff --git a/packages/hurumap-next/.eslintrc.js b/packages/hurumap-next/.eslintrc.js new file mode 100644 index 000000000..a728847a6 --- /dev/null +++ b/packages/hurumap-next/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ["eslint-config-commons-ui"], +}; diff --git a/packages/hurumap-next/.lintstagedrc.js b/packages/hurumap-next/.lintstagedrc.js new file mode 100644 index 000000000..bce8a3fb3 --- /dev/null +++ b/packages/hurumap-next/.lintstagedrc.js @@ -0,0 +1 @@ +module.exports = require("eslint-config-commons-ui/.lintstagedrc"); diff --git a/packages/hurumap-next/CHANGELOG.md b/packages/hurumap-next/CHANGELOG.md new file mode 100644 index 000000000..fba4c02e7 --- /dev/null +++ b/packages/hurumap-next/CHANGELOG.md @@ -0,0 +1,19 @@ +# @commons-ui/next + +## 2.0.1 + +### Patch Changes + +- [#247](https://github.com/CodeForAfrica/ui/pull/247) [`2a01454`](https://github.com/CodeForAfrica/ui/commit/2a014544fa84b7385cfa9496596699fdd1b3a0ba) Thanks [@kilemensi](https://github.com/kilemensi)! - Fixes playwright e2e testing + standardises SEO titles + +- Updated dependencies [[`2a01454`](https://github.com/CodeForAfrica/ui/commit/2a014544fa84b7385cfa9496596699fdd1b3a0ba)]: + - @commons-ui/core@2.0.1 + +## 2.0.0 + +### Patch Changes + +- [#241](https://github.com/CodeForAfrica/ui/pull/241) [`f792694`](https://github.com/CodeForAfrica/ui/commit/f7926944fb505adaa8905dc8aeba04913f56ea85) Thanks [@kilemensi](https://github.com/kilemensi)! - Improved RichTypography to better handle color and relative links + +- Updated dependencies [[`f792694`](https://github.com/CodeForAfrica/ui/commit/f7926944fb505adaa8905dc8aeba04913f56ea85)]: + - @commons-ui/core@2.0.0 diff --git a/packages/hurumap-next/jest.config.js b/packages/hurumap-next/jest.config.js new file mode 100644 index 000000000..4cf1a889d --- /dev/null +++ b/packages/hurumap-next/jest.config.js @@ -0,0 +1,13 @@ +const defaultConfig = require("jest-config-commons-ui/next"); + +const { moduleNameMapper } = defaultConfig; + +module.exports = { + ...defaultConfig, + moduleNameMapper: { + ...moduleNameMapper, + // Handle module aliases + "^@/hurumap/next/(.*)$": "/src/$1", + "^@/commons-ui/next/(.*)$": "/../commons-ui-next/src/$1", + }, +}; diff --git a/packages/hurumap-next/jest.setup.js b/packages/hurumap-next/jest.setup.js new file mode 100644 index 000000000..6f6929f58 --- /dev/null +++ b/packages/hurumap-next/jest.setup.js @@ -0,0 +1,12 @@ +/* eslint-env jest */ + +jest.mock("next/router", () => ({ + useRouter: jest.fn().mockImplementation(() => ({ + asPath: "", + isReady: true, + push: jest.fn(), + query: {}, + })), +})); + +module.exports = require("@commons-ui/testing-library/jest.setup"); diff --git a/packages/hurumap-next/jsconfig.json b/packages/hurumap-next/jsconfig.json new file mode 100644 index 000000000..b66383042 --- /dev/null +++ b/packages/hurumap-next/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/hurumap/next/*": ["./src/*"] + } + }, + "exclude": ["node_modules"] +} diff --git a/packages/hurumap-next/package.json b/packages/hurumap-next/package.json new file mode 100644 index 000000000..de2a2b9d3 --- /dev/null +++ b/packages/hurumap-next/package.json @@ -0,0 +1,66 @@ +{ + "name": "@hurumap/next", + "version": "0.0.1", + "private": false, + "author": "Code for Africa ", + "description": "", + "main": "./src/index.js", + "keywords": [ + "next", + "next.js", + "react", + "react-component", + "mui", + "material-ui", + "material design", + "hurumap" + ], + "repository": { + "type": "git", + "url": "https://github.com/codeforafrica/ui.git", + "directory": "packages/hurumap-next" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/codeforafrica/ui/issues" + }, + "scripts": { + "jest": "jest", + "lint-check": "TIMING=1 eslint './'", + "lint": "TIMING=1 eslint --fix './'", + "clean": "rm -rf .turbo node_modules dist" + }, + "devDependencies": { + "@babel/core": "^7.24.8", + "@babel/preset-react": "^7.24.7", + "@commons-ui/core": "workspace:*", + "@commons-ui/testing-library": "workspace:*", + "@mui/material": "^5.16.1", + "babel-loader": "^9.1.3", + "eslint": "^8.57.0", + "eslint-config-commons-ui": "workspace:*", + "jest": "^29.7.0", + "jest-config-commons-ui": "workspace:*", + "next": "^14.2.5", + "prop-types": "^15.8.1", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "require-from-string": "^2.0.2", + "typescript": "^5.5.3", + "webpack": "^5.93.0" + }, + "peerDependencies": { + "@babel/core": "^7.22.9", + "@commons-ui/core": "workspace:*", + "@mui/material": "^5.14.0", + "clsx": "^2.0.0", + "next": "~13.4.11", + "prop-types": "^15.8.1", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "dependencies": { + "clsx": "^2.1.1", + "@commons-ui/next": "workspace:*" + } +} diff --git a/packages/hurumap-core/src/Source/Source.js b/packages/hurumap-next/src/Source/Source.js similarity index 82% rename from packages/hurumap-core/src/Source/Source.js rename to packages/hurumap-next/src/Source/Source.js index 034b266e7..b43e812bf 100644 --- a/packages/hurumap-core/src/Source/Source.js +++ b/packages/hurumap-next/src/Source/Source.js @@ -2,19 +2,22 @@ import { Link } from "@commons-ui/next"; import { Typography } from "@mui/material"; import React from "react"; -const Source = React.forwardRef(function Source({ - children, - href, - title = "Source", - TitleTypographyProps, - LinkProps, - ...props -}) { +const Source = React.forwardRef(function Source( + { + children, + href, + title = "Source", + TitleTypographyProps, + LinkProps, + ...props + }, + ref, +) { if (!(href && children)) { return null; } return ( -
+
({ diff --git a/packages/hurumap-next/src/Source/Source.snap.js b/packages/hurumap-next/src/Source/Source.snap.js new file mode 100644 index 000000000..3c0a29d24 --- /dev/null +++ b/packages/hurumap-next/src/Source/Source.snap.js @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Source renders unchanged 1`] = ` +
+
+

+ Source + :  +

+ + Link to source + +
+
+`; diff --git a/packages/hurumap-next/src/Source/Source.test.js b/packages/hurumap-next/src/Source/Source.test.js new file mode 100644 index 000000000..1e9cc9fcc --- /dev/null +++ b/packages/hurumap-next/src/Source/Source.test.js @@ -0,0 +1,15 @@ +import { render } from "@commons-ui/testing-library"; +import * as React from "react"; + +import Source from "./Source"; + +describe("Source", () => { + it("renders unchanged", () => { + const { container } = render( + + Link to source + , + ); + expect(container).toMatchSnapshot(); + }); +}); diff --git a/packages/hurumap-core/src/Source/index.js b/packages/hurumap-next/src/Source/index.js similarity index 100% rename from packages/hurumap-core/src/Source/index.js rename to packages/hurumap-next/src/Source/index.js diff --git a/packages/hurumap-next/src/index.js b/packages/hurumap-next/src/index.js new file mode 100644 index 000000000..cce473009 --- /dev/null +++ b/packages/hurumap-next/src/index.js @@ -0,0 +1,2 @@ +/* eslint-disable import/prefer-default-export */ +export { default as Source } from "./Source"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1155fdc98..1a9872aca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -285,6 +285,9 @@ importers: '@hurumap/core': specifier: workspace:* version: link:../../packages/hurumap-core + '@hurumap/next': + specifier: workspace:* + version: link:../../packages/hurumap-next '@mui/lab': specifier: 5.0.0-alpha.155 version: 5.0.0-alpha.155(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -716,6 +719,9 @@ importers: '@hurumap/core': specifier: workspace:* version: link:../../packages/hurumap-core + '@hurumap/next': + specifier: workspace:* + version: link:../../packages/hurumap-next '@mui/lab': specifier: 5.0.0-alpha.155 version: 5.0.0-alpha.155(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@mui/material@5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1310,6 +1316,9 @@ importers: '@hurumap/core': specifier: workspace:* version: link:../../packages/hurumap-core + '@hurumap/next': + specifier: workspace:* + version: link:../../packages/hurumap-next '@mui/material': specifier: ^5.16.1 version: 5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1837,6 +1846,67 @@ importers: specifier: ^5.93.0 version: 5.93.0 + packages/hurumap-next: + dependencies: + '@commons-ui/next': + specifier: workspace:* + version: link:../commons-ui-next + clsx: + specifier: ^2.1.1 + version: 2.1.1 + devDependencies: + '@babel/core': + specifier: ^7.24.8 + version: 7.24.8 + '@babel/preset-react': + specifier: ^7.24.7 + version: 7.24.7(@babel/core@7.24.8) + '@commons-ui/core': + specifier: workspace:* + version: link:../commons-ui-core + '@commons-ui/testing-library': + specifier: workspace:* + version: link:../commons-ui-testing-library + '@mui/material': + specifier: ^5.16.1 + version: 5.16.1(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + babel-loader: + specifier: ^9.1.3 + version: 9.1.3(@babel/core@7.24.8)(webpack@5.93.0) + eslint: + specifier: ^8.57.0 + version: 8.57.0 + eslint-config-commons-ui: + specifier: workspace:* + version: link:../eslint-config-commons-ui + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@20.14.10)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.6.13(@swc/helpers@0.5.5))(@types/node@20.14.10)(typescript@5.5.3)) + jest-config-commons-ui: + specifier: workspace:* + version: link:../jest-config-commons-ui + next: + specifier: ^14.2.5 + version: 14.2.5(@babel/core@7.24.8)(@opentelemetry/api@1.9.0)(@playwright/test@1.45.1)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.69.4) + prop-types: + specifier: ^15.8.1 + version: 15.8.1 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) + require-from-string: + specifier: ^2.0.2 + version: 2.0.2 + typescript: + specifier: ^5.5.3 + version: 5.5.3 + webpack: + specifier: ^5.93.0 + version: 5.93.0 + packages/jest-config-commons-ui: dependencies: jest-environment-jsdom: From b8844b4362d12a612d0b797cb8580d21e24e0f07 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:35:19 +0300 Subject: [PATCH 4/8] Remove Unused files --- .../src/components/HURUmap/Source/index.js | 51 ------------------- .../HURUmap/Source/index.stories.js | 19 ------- .../src/components/HURUmap/Source/index.js | 51 ------------------- .../HURUmap/Source/index.stories.js | 19 ------- 4 files changed, 140 deletions(-) delete mode 100644 apps/climatemappedafrica/src/components/HURUmap/Source/index.js delete mode 100644 apps/climatemappedafrica/src/components/HURUmap/Source/index.stories.js delete mode 100644 apps/pesayetu/src/components/HURUmap/Source/index.js delete mode 100644 apps/pesayetu/src/components/HURUmap/Source/index.stories.js diff --git a/apps/climatemappedafrica/src/components/HURUmap/Source/index.js b/apps/climatemappedafrica/src/components/HURUmap/Source/index.js deleted file mode 100644 index a8bf88aae..000000000 --- a/apps/climatemappedafrica/src/components/HURUmap/Source/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import { Typography } from "@mui/material"; -import makeStyles from "@mui/styles/makeStyles"; -import PropTypes from "prop-types"; -import React from "react"; - -import Link from "@/climatemappedafrica/components/Link"; - -const useStyles = makeStyles(({ typography, palette }) => ({ - root: {}, - name: { - fontSize: typography.pxToRem(13), - lineHeight: 20 / 13, - color: "#666666", - display: "inline-flex", - fontWeight: 500, - }, - link: { - color: palette.text.primary, - fontSize: typography.pxToRem(13), - lineHeight: 20 / 13, - fontFamily: typography.body1.fontFamily, - fontWeight: 500, - }, -})); - -function Source({ children, href, ...props }) { - const classes = useStyles(props); - if (!(href && children)) { - return null; - } - return ( -
- Source:  - - {children} - -
- ); -} - -Source.propTypes = { - children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), - href: PropTypes.string, -}; - -Source.defaultProps = { - children: undefined, - href: undefined, -}; - -export default Source; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Source/index.stories.js b/apps/climatemappedafrica/src/components/HURUmap/Source/index.stories.js deleted file mode 100644 index a7407e076..000000000 --- a/apps/climatemappedafrica/src/components/HURUmap/Source/index.stories.js +++ /dev/null @@ -1,19 +0,0 @@ -import React from "react"; - -import Source from "."; - -export default { - title: "Components/Source", - argTypes: {}, -}; - -function Template({ ...args }) { - return ; -} - -export const Default = Template.bind({}); - -Default.args = { - name: "Source Name", - url: "Source Url", -}; diff --git a/apps/pesayetu/src/components/HURUmap/Source/index.js b/apps/pesayetu/src/components/HURUmap/Source/index.js deleted file mode 100644 index e704f6c01..000000000 --- a/apps/pesayetu/src/components/HURUmap/Source/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import { Typography } from "@mui/material"; -import makeStyles from "@mui/styles/makeStyles"; -import PropTypes from "prop-types"; -import React from "react"; - -import Link from "@/pesayetu/components/Link"; - -const useStyles = makeStyles(({ typography, palette }) => ({ - root: {}, - name: { - fontSize: typography.pxToRem(13), - lineHeight: 20 / 13, - color: "#666666", - display: "inline-flex", - fontWeight: 500, - }, - link: { - color: palette.text.primary, - fontSize: typography.pxToRem(13), - lineHeight: 20 / 13, - fontFamily: typography.body1.fontFamily, - fontWeight: 500, - }, -})); - -function Source({ children, href, ...props }) { - const classes = useStyles(props); - if (!(href && children)) { - return null; - } - return ( -
- Source:  - - {children} - -
- ); -} - -Source.propTypes = { - children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), - href: PropTypes.string, -}; - -Source.defaultProps = { - children: undefined, - href: undefined, -}; - -export default Source; diff --git a/apps/pesayetu/src/components/HURUmap/Source/index.stories.js b/apps/pesayetu/src/components/HURUmap/Source/index.stories.js deleted file mode 100644 index ba58e2466..000000000 --- a/apps/pesayetu/src/components/HURUmap/Source/index.stories.js +++ /dev/null @@ -1,19 +0,0 @@ -import React from "react"; - -import Source from "."; - -export default { - title: "HURUmap/Components/Source", - argTypes: {}, -}; - -function Template({ ...args }) { - return ; -} - -export const Default = Template.bind({}); - -Default.args = { - name: "Source Name", - url: "Source Url", -}; From dc7c72d30cb23a868bcc272d85770e0056cac452 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:50:33 +0300 Subject: [PATCH 5/8] Fix Import order --- apps/climatemappedafrica/src/components/HURUmap/Chart/index.js | 2 +- .../src/components/HURUmap/KeyMetric/index.js | 3 ++- apps/pesayetu/src/components/HURUmap/Chart/index.js | 2 +- apps/pesayetu/src/components/HURUmap/KeyMetric/index.js | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js index c818dacf8..9dd399e25 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js @@ -1,4 +1,3 @@ -import { Source } from "@hurumap/next"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; @@ -13,6 +12,7 @@ import { calculateTooltipPosition, idify } from "./utils"; import ChartTooltip from "@/climatemappedafrica/components/HURUmap/ChartTooltip"; import IndicatorTitle from "@/climatemappedafrica/components/HURUmap/IndicatorTitle"; +import { Source } from "@hurumap/next"; import theme from "@/climatemappedafrica/theme"; const useStyles = makeStyles(() => ({ diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js index 49d6a2712..5bce5220c 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js @@ -1,4 +1,3 @@ -import { Source } from "@hurumap/next"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; @@ -6,6 +5,8 @@ import React from "react"; import useStyles from "./useStyles"; +import { Source } from "@hurumap/next"; + function KeyMetric({ className, formattedValue: formattedValueProp, diff --git a/apps/pesayetu/src/components/HURUmap/Chart/index.js b/apps/pesayetu/src/components/HURUmap/Chart/index.js index 903460bba..4d26babc8 100644 --- a/apps/pesayetu/src/components/HURUmap/Chart/index.js +++ b/apps/pesayetu/src/components/HURUmap/Chart/index.js @@ -1,4 +1,3 @@ -import { Source } from "@hurumap/next"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; @@ -13,6 +12,7 @@ import { calculateTooltipPosition, idify } from "./utils"; import ChartTooltip from "@/pesayetu/components/HURUmap/ChartTooltip"; import IndicatorTitle from "@/pesayetu/components/HURUmap/IndicatorTitle"; +import { Source } from "@hurumap/next"; import theme from "@/pesayetu/theme"; const useStyles = makeStyles(() => ({ diff --git a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js index 49d6a2712..5bce5220c 100644 --- a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js +++ b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js @@ -1,4 +1,3 @@ -import { Source } from "@hurumap/next"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; @@ -6,6 +5,8 @@ import React from "react"; import useStyles from "./useStyles"; +import { Source } from "@hurumap/next"; + function KeyMetric({ className, formattedValue: formattedValueProp, From c0a0ddf2e00b6d761e32617d09af91581adcfd62 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:03:24 +0300 Subject: [PATCH 6/8] Fix linting issues --- apps/climatemappedafrica/src/components/HURUmap/Chart/index.js | 2 +- .../src/components/HURUmap/KeyMetric/index.js | 3 +-- apps/pesayetu/src/components/HURUmap/Chart/index.js | 2 +- apps/pesayetu/src/components/HURUmap/KeyMetric/index.js | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js index 9dd399e25..c818dacf8 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/next"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; @@ -12,7 +13,6 @@ import { calculateTooltipPosition, idify } from "./utils"; import ChartTooltip from "@/climatemappedafrica/components/HURUmap/ChartTooltip"; import IndicatorTitle from "@/climatemappedafrica/components/HURUmap/IndicatorTitle"; -import { Source } from "@hurumap/next"; import theme from "@/climatemappedafrica/theme"; const useStyles = makeStyles(() => ({ diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js index 5bce5220c..49d6a2712 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/next"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; @@ -5,8 +6,6 @@ import React from "react"; import useStyles from "./useStyles"; -import { Source } from "@hurumap/next"; - function KeyMetric({ className, formattedValue: formattedValueProp, diff --git a/apps/pesayetu/src/components/HURUmap/Chart/index.js b/apps/pesayetu/src/components/HURUmap/Chart/index.js index 4d26babc8..903460bba 100644 --- a/apps/pesayetu/src/components/HURUmap/Chart/index.js +++ b/apps/pesayetu/src/components/HURUmap/Chart/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/next"; import { useMediaQuery } from "@mui/material"; import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; @@ -12,7 +13,6 @@ import { calculateTooltipPosition, idify } from "./utils"; import ChartTooltip from "@/pesayetu/components/HURUmap/ChartTooltip"; import IndicatorTitle from "@/pesayetu/components/HURUmap/IndicatorTitle"; -import { Source } from "@hurumap/next"; import theme from "@/pesayetu/theme"; const useStyles = makeStyles(() => ({ diff --git a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js index 5bce5220c..49d6a2712 100644 --- a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js +++ b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js @@ -1,3 +1,4 @@ +import { Source } from "@hurumap/next"; import { Tooltip, Typography, LinearProgress } from "@mui/material"; import clsx from "clsx"; import PropTypes from "prop-types"; @@ -5,8 +6,6 @@ import React from "react"; import useStyles from "./useStyles"; -import { Source } from "@hurumap/next"; - function KeyMetric({ className, formattedValue: formattedValueProp, From 2d5311dcd4bd31d4f746eff933b407e3b7251955 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:55:01 +0300 Subject: [PATCH 7/8] Review fix --- .../src/components/HURUmap/KeyMetric/index.js | 2 +- .../src/components/HURUmap/KeyMetric/index.js | 2 +- packages/hurumap-core/package.json | 3 +-- packages/hurumap-next/CHANGELOG.md | 20 +------------------ packages/hurumap-next/package.json | 2 -- packages/hurumap-next/src/Source/Source.js | 4 ++-- pnpm-lock.yaml | 6 ------ 7 files changed, 6 insertions(+), 33 deletions(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js index 49d6a2712..6e39bbc24 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js @@ -69,7 +69,7 @@ function KeyMetric({ ({ - margin: `${theme.typography.pxToRem(20)} 0`, + marginTop: theme.typography.pxToRem(10), })} > {source} diff --git a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js index 49d6a2712..9816936a4 100644 --- a/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js +++ b/apps/pesayetu/src/components/HURUmap/KeyMetric/index.js @@ -69,7 +69,7 @@ function KeyMetric({ ({ - margin: `${theme.typography.pxToRem(20)} 0`, + marginTop: `${theme.typography.pxToRem(20)} 0`, })} > {source} diff --git a/packages/hurumap-core/package.json b/packages/hurumap-core/package.json index 6cd44cc5c..2ff1cc6db 100644 --- a/packages/hurumap-core/package.json +++ b/packages/hurumap-core/package.json @@ -67,7 +67,6 @@ "react-leaflet": "^4.2.1" }, "dependencies": { - "prop-types": "^15.8.1", - "@commons-ui/next": "workspace:*" + "prop-types": "^15.8.1" } } diff --git a/packages/hurumap-next/CHANGELOG.md b/packages/hurumap-next/CHANGELOG.md index fba4c02e7..051cf71eb 100644 --- a/packages/hurumap-next/CHANGELOG.md +++ b/packages/hurumap-next/CHANGELOG.md @@ -1,19 +1 @@ -# @commons-ui/next - -## 2.0.1 - -### Patch Changes - -- [#247](https://github.com/CodeForAfrica/ui/pull/247) [`2a01454`](https://github.com/CodeForAfrica/ui/commit/2a014544fa84b7385cfa9496596699fdd1b3a0ba) Thanks [@kilemensi](https://github.com/kilemensi)! - Fixes playwright e2e testing + standardises SEO titles - -- Updated dependencies [[`2a01454`](https://github.com/CodeForAfrica/ui/commit/2a014544fa84b7385cfa9496596699fdd1b3a0ba)]: - - @commons-ui/core@2.0.1 - -## 2.0.0 - -### Patch Changes - -- [#241](https://github.com/CodeForAfrica/ui/pull/241) [`f792694`](https://github.com/CodeForAfrica/ui/commit/f7926944fb505adaa8905dc8aeba04913f56ea85) Thanks [@kilemensi](https://github.com/kilemensi)! - Improved RichTypography to better handle color and relative links - -- Updated dependencies [[`f792694`](https://github.com/CodeForAfrica/ui/commit/f7926944fb505adaa8905dc8aeba04913f56ea85)]: - - @commons-ui/core@2.0.0 +# @hurumap/next diff --git a/packages/hurumap-next/package.json b/packages/hurumap-next/package.json index de2a2b9d3..3d2f6055b 100644 --- a/packages/hurumap-next/package.json +++ b/packages/hurumap-next/package.json @@ -53,14 +53,12 @@ "@babel/core": "^7.22.9", "@commons-ui/core": "workspace:*", "@mui/material": "^5.14.0", - "clsx": "^2.0.0", "next": "~13.4.11", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0" }, "dependencies": { - "clsx": "^2.1.1", "@commons-ui/next": "workspace:*" } } diff --git a/packages/hurumap-next/src/Source/Source.js b/packages/hurumap-next/src/Source/Source.js index b43e812bf..b4f4b7c0d 100644 --- a/packages/hurumap-next/src/Source/Source.js +++ b/packages/hurumap-next/src/Source/Source.js @@ -4,11 +4,11 @@ import React from "react"; const Source = React.forwardRef(function Source( { + LinkProps, + TitleTypographyProps, children, href, title = "Source", - TitleTypographyProps, - LinkProps, ...props }, ref, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1a9872aca..77dfb1332 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1769,9 +1769,6 @@ importers: packages/hurumap-core: dependencies: - '@commons-ui/next': - specifier: workspace:* - version: link:../commons-ui-next prop-types: specifier: ^15.8.1 version: 15.8.1 @@ -1851,9 +1848,6 @@ importers: '@commons-ui/next': specifier: workspace:* version: link:../commons-ui-next - clsx: - specifier: ^2.1.1 - version: 2.1.1 devDependencies: '@babel/core': specifier: ^7.24.8 From af0c1a6622f95311d8c7b53b836b276ad6c39c97 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:02:55 +0300 Subject: [PATCH 8/8] Es lint config Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> --- packages/hurumap-next/.eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hurumap-next/.eslintrc.js b/packages/hurumap-next/.eslintrc.js index a728847a6..c867daf1b 100644 --- a/packages/hurumap-next/.eslintrc.js +++ b/packages/hurumap-next/.eslintrc.js @@ -1,4 +1,4 @@ module.exports = { root: true, - extends: ["eslint-config-commons-ui"], + extends: ["eslint-config-commons-ui/next"], };