Skip to content

Commit

Permalink
Merge pull request #785 from CodeForAfrica/ft/hurumap-source
Browse files Browse the repository at this point in the history
HURUMap Source
  • Loading branch information
kelvinkipruto committed Jul 17, 2024
2 parents ed6d830 + af0c1a6 commit 2923822
Show file tree
Hide file tree
Showing 29 changed files with 367 additions and 168 deletions.
1 change: 1 addition & 0 deletions apps/climatemappedafrica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 8 additions & 6 deletions apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -12,20 +13,16 @@ 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%",
},
chart: {
width: "100%",
},
source: {
margin: `${typography.pxToRem(20)} 0`,
},
}));

function Chart({
Expand Down Expand Up @@ -242,7 +239,12 @@ function Chart({
/>
)}
<div ref={chartRef} className={classes.chart} />
<Source href={url} classes={{ root: classes.source }}>
<Source
href={url}
sx={({ typography }) => ({
margin: `${typography.pxToRem(20)} 0`,
})}
>
{source}
</Source>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Source } from "@hurumap/next";
import { Tooltip, Typography, LinearProgress } from "@mui/material";
import clsx from "clsx";
import PropTypes from "prop-types";
import React from "react";

import useStyles from "./useStyles";

import Source from "@/climatemappedafrica/components/HURUmap/Source";

function KeyMetric({
className,
formattedValue: formattedValueProp,
Expand Down Expand Up @@ -67,7 +66,12 @@ function KeyMetric({
{parentValue}
</Typography>
)}
<Source href={url} classes={{ root: classes.source }}>
<Source
href={url}
sx={(theme) => ({
marginTop: theme.typography.pxToRem(10),
})}
>
{source}
</Source>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const useStyles = makeStyles(({ typography, palette }) => ({
progressBarDeterminate: {
backgroundColor: palette.grey.main,
},
source: {
marginTop: typography.pxToRem(10),
},
text: {
fontSize: typography.pxToRem(11),
},
Expand Down
51 changes: 0 additions & 51 deletions apps/climatemappedafrica/src/components/HURUmap/Source/index.js

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions apps/pesayetu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 8 additions & 6 deletions apps/pesayetu/src/components/HURUmap/Chart/index.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -12,20 +13,16 @@ 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%",
},
chart: {
width: "100%",
},
source: {
margin: `${typography.pxToRem(20)} 0`,
},
}));

function Chart({
Expand Down Expand Up @@ -239,7 +236,12 @@ function Chart({
/>
)}
<div ref={chartRef} className={classes.chart} />
<Source href={url} classes={{ root: classes.source }}>
<Source
href={url}
sx={({ typography }) => ({
margin: `${typography.pxToRem(20)} 0`,
})}
>
{source}
</Source>
</div>
Expand Down
10 changes: 7 additions & 3 deletions apps/pesayetu/src/components/HURUmap/KeyMetric/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Source } from "@hurumap/next";
import { Tooltip, Typography, LinearProgress } from "@mui/material";
import clsx from "clsx";
import PropTypes from "prop-types";
import React from "react";

import useStyles from "./useStyles";

import Source from "@/pesayetu/components/HURUmap/Source";

function KeyMetric({
className,
formattedValue: formattedValueProp,
Expand Down Expand Up @@ -67,7 +66,12 @@ function KeyMetric({
{parentValue}
</Typography>
)}
<Source href={url} classes={{ root: classes.source }}>
<Source
href={url}
sx={(theme) => ({
marginTop: `${theme.typography.pxToRem(20)} 0`,
})}
>
{source}
</Source>
</div>
Expand Down
3 changes: 0 additions & 3 deletions apps/pesayetu/src/components/HURUmap/KeyMetric/useStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const useStyles = makeStyles(({ typography, palette }) => ({
progressBarDeterminate: {
backgroundColor: palette.grey.main,
},
source: {
marginTop: typography.pxToRem(10),
},
text: {
fontSize: typography.pxToRem(11),
},
Expand Down
51 changes: 0 additions & 51 deletions apps/pesayetu/src/components/HURUmap/Source/index.js

This file was deleted.

19 changes: 0 additions & 19 deletions apps/pesayetu/src/components/HURUmap/Source/index.stories.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/uibook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
35 changes: 35 additions & 0 deletions apps/uibook/stories/HURUmap/next/Source.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Source } from "@hurumap/next";
import React from "react";

export default {
title: "@hurumap/next/Source",
argTypes: {
children: {
control: {
type: "text",
},
},
href: {
control: {
type: "text",
},
},
title: {
control: {
type: "text",
},
},
},
};

function Template({ ...args }) {
return <Source {...args} />;
}

export const Default = Template.bind({});

Default.args = {
children: "Source Name",
href: "https://example.com",
title: "Source",
};
2 changes: 1 addition & 1 deletion packages/hurumap-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit 2923822

Please sign in to comment.