Skip to content

Commit

Permalink
Remove Old Commons-ui QuickLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinkipruto committed Dec 14, 2024
1 parent 576ac69 commit f785b91
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 149 deletions.
1 change: 0 additions & 1 deletion apps/climatemappedafrica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"dependencies": {
"@apollo/client": "catalog:",
"@commons-ui/core": "workspace:*",
"@commons-ui/legacy": "catalog:",
"@commons-ui/next": "workspace:*",
"@commons-ui/payload": "workspace:*",
"@emotion/react": "catalog:",
Expand Down
51 changes: 41 additions & 10 deletions apps/climatemappedafrica/src/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Copyright } from "@commons-ui/core";
import { QuickLinks } from "@commons-ui/legacy";
import { Copyright, QuickLinks } from "@commons-ui/core";
import { Link, StayInTouch } from "@commons-ui/next";
import { RichText } from "@commons-ui/payload";
import { Box, Grid, useTheme } from "@mui/material";
import React from "react";

import useStyles from "./useStyles";

import NextImageButton from "@/climatemappedafrica/components/NextImageButton";
import Section from "@/climatemappedafrica/components/Section";

Expand All @@ -19,7 +16,6 @@ function Footer(props) {
links,
variant,
} = props;
const classes = useStyles(props);
const theme = useTheme();

return (
Expand Down Expand Up @@ -136,11 +132,46 @@ function Footer(props) {
<QuickLinks
linkComponent={Link}
{...links}
classes={{
root: classes.quickLinkRoot,
list: classes.quickList,
link: classes.quickLink,
title: classes.quickLinksTitle,
sx={{
textAlign: {
xs: "center",
lg: "inherit",
},
padding: {
xs: `${theme.typography.pxToRem(32)} 0 `,
lg: 0,
},
}}
TitleProps={{
variant: "caption",
sx: {
color: theme.palette.text.secondary,
fontSize: theme.typography.subtitle2.fontSize,
fontWeight: "bold",
},
}}
LinksProps={{
variant: "caption",
sx: {
listStyle: "none",
color: theme.palette.text.secondary,
padding: 0,
letterspacing: theme.typography.pxToRem(0.7),
"& > li": {
marginTop: theme.typography.pxToRem(16),
},
},
}}
LinkProps={{
variant: "caption",
sx: {
fontSize: theme.typography.subtitle1.fontSize,
color: theme.palette.text.secondary,
fontWeight: "normal",
"&:hover": {
color: theme.palette.primary.light,
},
},
}}
/>
)}
Expand Down
57 changes: 0 additions & 57 deletions apps/climatemappedafrica/src/components/Footer/useStyles.js

This file was deleted.

66 changes: 66 additions & 0 deletions packages/commons-ui-core/src/QuickLinks/QuickLinks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Box, Link, Typography } from "@mui/material";
import React from "react";

const QuickLinks = React.forwardRef(function QuickLinks(props, ref) {
const { linkComponent, links, LinksProps, LinkProps, title, TitleProps, sx } =
props;
const LinkComponent = linkComponent || Link;

return (
<Box
sx={{
width: "100%",
paddingBottom: {
xs: "unset",
md: "0.5rem",
},
...sx,
}}
ref={ref}
>
<Typography
{...TitleProps}
sx={{
lineHeight: "inherit",
...TitleProps?.sx,
}}
>
{title}
</Typography>
<Typography
{...LinksProps}
sx={{
listStyle: "none",
padding: 0,
paddingTop: "1rem",
"& > li": {
marginTop: {
xs: "2.3125rem",
md: "1.5rem",
},
},
...LinksProps?.sx,
}}
component="ul"
>
{links.map(({ label, ...others }) => (
<li key={label}>
<LinkComponent
{...others}
underline="none"
{...LinkProps}
sx={{
textDecoration: "none",
...LinkProps?.sx,
}}
>
{label}
</LinkComponent>
</li>
))}
</Typography>
</Box>
);
});

export default QuickLinks;
3 changes: 3 additions & 0 deletions packages/commons-ui-core/src/QuickLinks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import QuickLinks from "./QuickLinks";

export default QuickLinks;
1 change: 1 addition & 0 deletions packages/commons-ui-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export { default as RichTypography } from "./RichTypography";
export { default as Section } from "./Section";
export { default as SocialMediaIconLink } from "./SocialMediaIconLink";
export { default as StayInTouch } from "./StayInTouch";
export { default as QuickLinks } from "./QuickLinks";
Loading

0 comments on commit f785b91

Please sign in to comment.