From b187813d30b554398cf92004e4fbdb0e3cedab32 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 28 Aug 2024 15:09:39 +0300 Subject: [PATCH 01/12] chore: Remove default props in Explore component --- apps/climatemappedafrica/src/pages/explore/[[...slug]].js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/climatemappedafrica/src/pages/explore/[[...slug]].js b/apps/climatemappedafrica/src/pages/explore/[[...slug]].js index 8bb73f377..60c2fbc14 100644 --- a/apps/climatemappedafrica/src/pages/explore/[[...slug]].js +++ b/apps/climatemappedafrica/src/pages/explore/[[...slug]].js @@ -11,9 +11,7 @@ import { } from "@/climatemappedafrica/lib/hurumap"; export default function Explore(props) { - const { - blocks: { tutorial, panel }, - } = props; + const { blocks: { tutorial = {}, panel = {} } = {} } = props; const { query: { showTutorial }, } = useRouter(); @@ -40,10 +38,6 @@ Explore.propTypes = { }), }; -Explore.defaultProps = { - blocks: undefined, -}; - export async function getStaticPaths() { const { locations } = await fetchProfile(); const paths = locations.map(({ code: locationCode }) => ({ From 409f1252c48cf4bcecac934e527f1b7806e63bbd Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 28 Aug 2024 15:14:22 +0300 Subject: [PATCH 02/12] chore: Remove defaults props in Tutorial component --- .../src/components/HURUmap/Tutorial/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js index 49ff4ad78..5d3734c2f 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js @@ -27,7 +27,12 @@ const useStyles = makeStyles(({ typography, palette }) => ({ }, })); -function Tutorial({ children, defaultOpen, items, ...props }) { +function Tutorial({ + children = undefined, + defaultOpen = false, + items = [], + ...props +}) { const classes = useStyles(props); const { setIsOpen } = useTour(); setIsOpen(defaultOpen); @@ -80,10 +85,4 @@ Tutorial.propTypes = { defaultOpen: PropTypes.bool, }; -Tutorial.defaultProps = { - items: undefined, - children: undefined, - defaultOpen: false, -}; - export default Tutorial; From 94f0a1e08081ea6ac99bc4136424d09de7894d73 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 28 Aug 2024 15:18:20 +0300 Subject: [PATCH 03/12] chore: Remove default props in Page/index.js --- apps/climatemappedafrica/src/components/Page/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/climatemappedafrica/src/components/Page/index.js b/apps/climatemappedafrica/src/components/Page/index.js index c119e9369..1de1d1e3e 100644 --- a/apps/climatemappedafrica/src/components/Page/index.js +++ b/apps/climatemappedafrica/src/components/Page/index.js @@ -7,7 +7,7 @@ import Base from "./Base"; * Page component that adds error handling. * TODO(kilemensi): Add error handling once we have error page designs */ -function Page({ errorCode, ...props }) { +function Page({ ...props }) { return ; } @@ -15,8 +15,4 @@ Page.propTypes = { errorCode: PropTypes.number, }; -Page.defaultProps = { - errorCode: undefined, -}; - export default Page; From f3af8238151a52dd46cc42c6b5d9bec5dc22f8eb Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 28 Aug 2024 15:24:48 +0300 Subject: [PATCH 04/12] chore: Remove default props in BasePage --- .../climatemappedafrica/src/components/Page/Base.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/climatemappedafrica/src/components/Page/Base.js b/apps/climatemappedafrica/src/components/Page/Base.js index 8d8336526..3986a8a29 100644 --- a/apps/climatemappedafrica/src/components/Page/Base.js +++ b/apps/climatemappedafrica/src/components/Page/Base.js @@ -13,7 +13,12 @@ import getNavigationMenu from "@/climatemappedafrica/functions/menus/getNavigati /** * Base page that can be used to build all other pages. */ -function BasePage({ children, menus, variant, post, ...props }) { +function BasePage({ + children = undefined, + menus = undefined, + variant = undefined, + ...props +}) { const seo = {}; const footerProps = getFooterMenu(menus?.footerMenu || []); const navigation = getNavigationMenu(menus?.primaryMenu || []); @@ -77,10 +82,4 @@ BasePage.propTypes = { variant: PropTypes.string, }; -BasePage.defaultProps = { - children: undefined, - menus: undefined, - variant: undefined, -}; - export default BasePage; From b00250d51e170eda6f8b46687091415ef09438a7 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Thu, 29 Aug 2024 09:54:21 +0300 Subject: [PATCH 05/12] chore: Remove default props for fuctional components in Climatemappedafrica --- .../src/components/DropdownSearch/index.js | 24 +++++--------- .../src/components/ExplorePage/index.js | 13 ++++---- .../src/components/Footer/index.js | 24 +++++--------- .../HURUmap/LocationHeader/index.js | 17 +++++----- .../Panel/DesktopPanel/PanelButtons.js | 27 +++++----------- .../HURUmap/Panel/DesktopPanel/PanelItem.js | 6 +--- .../HURUmap/Panel/DesktopPanel/RichData.js | 6 +--- .../HURUmap/Panel/DesktopPanel/index.js | 9 ------ .../HURUmap/Panel/MobilePanel/index.js | 14 +++------ .../HURUmap/PanelButtonGroup/index.js | 15 +++++---- .../components/HURUmap/PinAndCompare/index.js | 27 +++++----------- .../src/components/HURUmap/TreeView/index.js | 7 +---- .../src/components/Image/index.js | 11 +++---- .../Navigation/ExploreNavigation/index.js | 9 ------ .../Navigation/MobileNavigation/index.js | 19 +++--------- .../src/components/Navigation/index.js | 6 +--- .../src/components/Section/index.js | 7 +---- .../src/components/Select/index.js | 31 ++++++------------- .../src/components/Tabs/index.js | 18 +++-------- 19 files changed, 86 insertions(+), 204 deletions(-) diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/index.js b/apps/climatemappedafrica/src/components/DropdownSearch/index.js index b0811021f..473626af5 100644 --- a/apps/climatemappedafrica/src/components/DropdownSearch/index.js +++ b/apps/climatemappedafrica/src/components/DropdownSearch/index.js @@ -62,13 +62,13 @@ const useStyles = makeStyles(({ palette, typography }) => ({ })); function DropdownSearch({ - href: hrefProp, - label, - counties, - onClick, - icon: iconProp, - placeholder, - variant, + href: hrefProp = "/explore", + label = "Search for a location", + counties = undefined, + onClick = undefined, + icon: iconProp = SearchIcon, + placeholder = undefined, + variant = undefined, ...props }) { const classes = useStyles(props); @@ -176,14 +176,4 @@ DropdownSearch.propTypes = { placeholder: PropTypes.string, }; -DropdownSearch.defaultProps = { - label: "Search for a location", - href: "/explore", - onClick: undefined, - icon: SearchIcon, - counties: undefined, - variant: undefined, - placeholder: undefined, -}; - export default DropdownSearch; diff --git a/apps/climatemappedafrica/src/components/ExplorePage/index.js b/apps/climatemappedafrica/src/components/ExplorePage/index.js index 73bab2ca7..1032aa457 100644 --- a/apps/climatemappedafrica/src/components/ExplorePage/index.js +++ b/apps/climatemappedafrica/src/components/ExplorePage/index.js @@ -21,7 +21,12 @@ function initialState(profiles, onClick) { }; } -function ExplorePage({ panelProps, profile: profileProp, ...props }) { +function ExplorePage({ + panelProps = undefined, + profile: profileProp = undefined, + apiUri, + ...props +}) { const theme = useTheme(); const classes = useStyles(props); // NOTE: This setState and the corresponding useEffect are "hacks" since at @@ -186,10 +191,4 @@ ExplorePage.propTypes = { ]), }; -ExplorePage.defaultProps = { - apiUri: undefined, - panelProps: undefined, - profile: undefined, -}; - export default ExplorePage; diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js index ce8464e68..9e22051a8 100644 --- a/apps/climatemappedafrica/src/components/Footer/index.js +++ b/apps/climatemappedafrica/src/components/Footer/index.js @@ -17,13 +17,13 @@ import Link from "@/climatemappedafrica/components/Link"; import Section from "@/climatemappedafrica/components/Section"; function Footer({ - title, - logoProps, - aboutVariant, - description, - copyrightProps, - quickLinks: quickLinksProp, - socialMedia, + title = undefined, + logoProps = undefined, + aboutVariant = "subtitle1", + description = undefined, + copyrightProps = undefined, + quickLinks: quickLinksProp = undefined, + socialMedia = undefined, ...props }) { const classes = useStyles(props); @@ -123,14 +123,4 @@ Footer.propTypes = { copyrightProps: PropTypes.shape({}), }; -Footer.defaultProps = { - title: undefined, - description: undefined, - socialMedia: undefined, - quickLinks: undefined, - copyrightProps: undefined, - logoProps: undefined, - aboutVariant: "subtitle1", -}; - export default Footer; diff --git a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js index 84a7e2d42..78d5f890a 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js @@ -18,7 +18,14 @@ function SvgIcon(props) { return ; } -function LocationHeader({ icon, level, onClick, parent, title, ...props }) { +function LocationHeader({ + icon = undefined, + level = undefined, + onClick = undefined, + parent = undefined, + title = undefined, + ...props +}) { const classes = useStyles(props); if (!title) { @@ -79,12 +86,4 @@ LocationHeader.propTypes = { title: PropTypes.string, }; -LocationHeader.defaultProps = { - icon: undefined, - level: undefined, - onClick: undefined, - parent: undefined, - title: undefined, -}; - export default LocationHeader; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js index fdcc6af3a..96afd0677 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js @@ -8,14 +8,14 @@ import useStyles from "./useStyles"; import PanelButtonGroup from "@/climatemappedafrica/components/HURUmap/PanelButtonGroup"; function PanelButtons({ - isPinning, - isCompare, - onClickPin, - onClickUnpin, - panelItems: panelItemsProp, - primaryProfile, - secondaryProfile, - drawerRef, + isPinning = undefined, + isCompare = undefined, + onClickPin = undefined, + onClickUnpin = undefined, + panelItems: panelItemsProp = undefined, + primaryProfile = undefined, + secondaryProfile = undefined, + drawerRef = undefined, ...props }) { const [value, setValue] = useState(); @@ -171,15 +171,4 @@ PanelButtons.propTypes = { }), }; -PanelButtons.defaultProps = { - drawerRef: undefined, - isCompare: undefined, - isPinning: undefined, - onClickPin: undefined, - onClickUnpin: undefined, - panelItems: undefined, - primaryProfile: undefined, - secondaryProfile: undefined, -}; - export default PanelButtons; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js index 191902e83..a6b7162e8 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js @@ -3,7 +3,7 @@ import React from "react"; import RichData from "./RichData"; -function PanelItem({ item, ...props }) { +function PanelItem({ item = undefined, ...props }) { const key = item.value; switch (key) { case "rich-data": // fallthrough @@ -18,8 +18,4 @@ PanelItem.propTypes = { }), }; -PanelItem.defaultProps = { - item: undefined, -}; - export default PanelItem; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js index 53ce093a6..7751a1f61 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js @@ -6,7 +6,7 @@ import useStyles from "./useStyles"; import Profile from "@/climatemappedafrica/components/HURUmap/Panel/Profile"; import TreeView from "@/climatemappedafrica/components/HURUmap/TreeView"; -function RichData({ primaryProfile, ...props }) { +function RichData({ primaryProfile = undefined, ...props }) { const classes = useStyles(props); const profileRef = useRef(); @@ -40,8 +40,4 @@ RichData.propTypes = { }), }; -RichData.defaultProps = { - primaryProfile: undefined, -}; - export default RichData; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/index.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/index.js index 8c12bd327..453856583 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/index.js @@ -48,13 +48,4 @@ DesktopPanel.propTypes = { }), }; -DesktopPanel.defaultProps = { - isCompare: undefined, - isPinning: undefined, - onClickPin: undefined, - onClickUnpin: undefined, - panelItems: undefined, - primaryProfile: undefined, -}; - export default DesktopPanel; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js index 070e71c2f..e93c593ca 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js @@ -16,7 +16,11 @@ import { hurumapArgs } from "@/climatemappedafrica/config"; // eslint-disable-next-line import/order import useStyles from "./useStyles"; -function MobilePanel({ scrollToTopLabel, activeType, ...props }) { +function MobilePanel({ + scrollToTopLabel = undefined, + activeType = undefined, + ...props +}) { const classes = useStyles(props); const { onSelectLocation, primaryProfile, dataNotAvailable } = props; const { geography, items } = primaryProfile; @@ -112,12 +116,4 @@ MobilePanel.propTypes = { scrollToTopLabel: PropTypes.string, }; -MobilePanel.defaultProps = { - activeType: undefined, - dataNotAvailable: undefined, - onSelectLocation: undefined, - primaryProfile: undefined, - scrollToTopLabel: undefined, -}; - export default MobilePanel; diff --git a/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js b/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js index 58432e37f..f76e2fbf5 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js @@ -7,7 +7,13 @@ import React from "react"; import useStyles from "./useStyles"; -function PanelButtonGroup({ items, value, onChange, pins, ...props }) { +function PanelButtonGroup({ + items = undefined, + value = undefined, + onChange = undefined, + pins = [], + ...props +}) { const classes = useStyles(props); const handleChange = (_, selected) => { onChange(selected); @@ -63,11 +69,4 @@ PanelButtonGroup.propTypes = { onChange: PropTypes.func, }; -PanelButtonGroup.defaultProps = { - pins: [], - items: undefined, - value: undefined, - onChange: undefined, -}; - export default PanelButtonGroup; diff --git a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js index 32bb0f29f..71f37a0c4 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js @@ -13,14 +13,14 @@ function PinIcon(props) { } function PinAndCompare({ - helperText, - isMobile, - currentGeographyCode, - locations, - onChange, - onClose, - onClickPin, - placeholder, + helperText = undefined, + isMobile = false, + currentGeographyCode = undefined, + locations = undefined, + onChange = undefined, + onClickPin = undefined, + onClose = undefined, + placeholder = undefined, ...props }) { const classes = useStyles(props); @@ -110,15 +110,4 @@ PinAndCompare.propTypes = { placeholder: PropTypes.string, }; -PinAndCompare.defaultProps = { - helperText: undefined, - isMobile: false, - currentGeographyCode: undefined, - locations: undefined, - onChange: undefined, - onClickPin: undefined, - onClose: undefined, - placeholder: undefined, -}; - export default PinAndCompare; diff --git a/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js b/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js index 668325f64..dcaac9da5 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js @@ -10,7 +10,7 @@ import useStyles from "./useStyles"; import { ReactComponent as CheckIcon } from "@/climatemappedafrica/assets/icons/checked.svg"; import slugify from "@/climatemappedafrica/utils/slugify"; -function TreeView({ items, onLabelClick, ...props }) { +function TreeView({ items = undefined, onLabelClick = undefined, ...props }) { const classes = useStyles(props); const [expanded, setExpanded] = useState(); @@ -89,9 +89,4 @@ TreeView.propTypes = { onLabelClick: PropTypes.func, }; -TreeView.defaultProps = { - items: undefined, - onLabelClick: undefined, -}; - export default TreeView; diff --git a/apps/climatemappedafrica/src/components/Image/index.js b/apps/climatemappedafrica/src/components/Image/index.js index 388b6f627..aafc6bf5b 100644 --- a/apps/climatemappedafrica/src/components/Image/index.js +++ b/apps/climatemappedafrica/src/components/Image/index.js @@ -2,7 +2,11 @@ import NImage from "next/image"; import PropTypes from "prop-types"; import React from "react"; -function Image({ placeholder: placeholderProp, src, ...props }) { +function Image({ + placeholder: placeholderProp = undefined, + src = undefined, + ...props +}) { if (!src) { return null; } @@ -16,9 +20,4 @@ Image.propTypes = { src: PropTypes.oneOfType([PropTypes.shape({}), PropTypes.string]), }; -Image.defaultProps = { - placeholder: undefined, - src: undefined, -}; - export default Image; diff --git a/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js index fbaa55a92..82420055c 100644 --- a/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js +++ b/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js @@ -146,13 +146,4 @@ ExploreNavigation.propTypes = { }), }; -ExploreNavigation.defaultProps = { - logoProps: undefined, - menuProps: undefined, - onOpenHelp: undefined, - socialLinks: undefined, - desktopLogoProps: undefined, - mobileLogoProps: undefined, -}; - export default ExploreNavigation; diff --git a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js index 0f6e5ccc1..a277df2d8 100644 --- a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js +++ b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js @@ -158,12 +158,12 @@ const Transition = React.forwardRef(function Transition(props, ref) { }); function MobileNavigation({ + drawerLogoProps = undefined, + href = "/explore", + menuProps = undefined, + mobileLogoProps = undefined, + socialLinks = undefined, logoProps, - menuProps, - mobileLogoProps, - drawerLogoProps, - socialLinks, - href, ...props }) { const classes = useStyles(props); @@ -308,13 +308,4 @@ MobileNavigation.propTypes = { socialLinks: PropTypes.arrayOf(PropTypes.shape({})), }; -MobileNavigation.defaultProps = { - drawerLogoProps: undefined, - href: "/explore", - logoProps: undefined, - menuProps: undefined, - mobileLogoProps: undefined, - socialLinks: undefined, -}; - export default MobileNavigation; diff --git a/apps/climatemappedafrica/src/components/Navigation/index.js b/apps/climatemappedafrica/src/components/Navigation/index.js index 1a720ee8f..72eaebbdf 100644 --- a/apps/climatemappedafrica/src/components/Navigation/index.js +++ b/apps/climatemappedafrica/src/components/Navigation/index.js @@ -28,7 +28,7 @@ const useStyles = makeStyles( }), ); -function Navigation({ variant, ...props }) { +function Navigation({ variant = undefined, ...props }) { const classes = useStyles(props); return ( @@ -76,8 +76,4 @@ Navigation.propTypes = { variant: PropTypes.string, }; -Navigation.defaultProps = { - variant: undefined, -}; - export default Navigation; diff --git a/apps/climatemappedafrica/src/components/Section/index.js b/apps/climatemappedafrica/src/components/Section/index.js index dadeceead..b14488b59 100644 --- a/apps/climatemappedafrica/src/components/Section/index.js +++ b/apps/climatemappedafrica/src/components/Section/index.js @@ -21,7 +21,7 @@ const useStyles = makeStyles(({ breakpoints, typography, widths }) => ({ }, {}), })); -function Section({ className, fixed, ...props }) { +function Section({ className = undefined, fixed = true, ...props }) { const classes = useStyles(props); return ( @@ -44,9 +44,4 @@ Section.propTypes = { fixed: PropTypes.bool, }; -Section.defaultProps = { - className: undefined, - fixed: true, -}; - export default Section; diff --git a/apps/climatemappedafrica/src/components/Select/index.js b/apps/climatemappedafrica/src/components/Select/index.js index ec884a3f4..d81baaa0e 100644 --- a/apps/climatemappedafrica/src/components/Select/index.js +++ b/apps/climatemappedafrica/src/components/Select/index.js @@ -21,16 +21,16 @@ function ExpandMoreIcon(props) { } function Input({ - disabled, - helperText, - label: labelProp, - onChange, - onOpen, - onClose, - open, - options, - selected, - placeholder, + disabled = undefined, + helperText = undefined, + label: labelProp = undefined, + onChange = undefined, + onOpen = undefined, + onClose = undefined, + open = undefined, + options = undefined, + selected = undefined, + placeholder = undefined, ...props }) { const classes = useStyles(props); @@ -128,15 +128,4 @@ Input.propTypes = { selected: PropTypes.string, }; -Input.defaultProps = { - disabled: undefined, - helperText: undefined, - onChange: undefined, - onOpen: undefined, - onClose: undefined, - open: undefined, - placeholder: undefined, - selected: undefined, -}; - export default Input; diff --git a/apps/climatemappedafrica/src/components/Tabs/index.js b/apps/climatemappedafrica/src/components/Tabs/index.js index 3ad7f71e6..a888a3894 100644 --- a/apps/climatemappedafrica/src/components/Tabs/index.js +++ b/apps/climatemappedafrica/src/components/Tabs/index.js @@ -15,11 +15,11 @@ function a11yProps(name, index) { } function Tabs({ - activeTab, - items, - name: nameProp, - onChange, - linkComponent, + activeTab = 0, + items = undefined, + name: nameProp = undefined, + onChange = undefined, + linkComponent = undefined, ...props }) { const router = useRouter(); @@ -105,12 +105,4 @@ Tabs.propTypes = { onChange: PropTypes.func, }; -Tabs.defaultProps = { - activeTab: 0, - items: undefined, - linkComponent: undefined, - name: undefined, - onChange: undefined, -}; - export default Tabs; From 5f790833679b0f46e64f173b24d9485599fb0db4 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Thu, 29 Aug 2024 12:37:56 +0300 Subject: [PATCH 06/12] chore: Use implicit undefined default parameter for all functional components with removed default props --- .../src/components/DropdownSearch/index.js | 8 +++---- .../src/components/ExplorePage/index.js | 7 +----- .../src/components/Footer/index.js | 12 +++++----- .../HURUmap/CategoryHeader/index.js | 6 ----- .../src/components/HURUmap/Chart/Filters.js | 8 ------- .../components/HURUmap/ChartFilter/index.js | 6 ++--- .../src/components/HURUmap/KeyMetric/index.js | 13 ----------- .../HURUmap/LocationHeader/index.js | 9 +------- .../Panel/DesktopPanel/PanelButtons.js | 16 +++++++------- .../HURUmap/Panel/DesktopPanel/RichData.js | 2 +- .../HURUmap/Panel/MobilePanel/RichData.js | 7 +----- .../Panel/MobilePanel/SubcategoryList.js | 4 ---- .../HURUmap/Panel/MobilePanel/index.js | 6 +---- .../src/components/HURUmap/Panel/Profile.js | 12 ---------- .../components/HURUmap/Panel/ProfileItems.js | 10 --------- .../HURUmap/PanelButtonGroup/index.js | 8 +------ .../components/HURUmap/PinAndCompare/index.js | 14 ++++++------ .../HURUmap/SubcategoryHeader/index.js | 5 ----- .../src/components/HURUmap/TreeView/index.js | 2 +- .../HURUmap/Tutorial/TutorialStep/index.js | 8 ------- .../src/components/HURUmap/Tutorial/index.js | 7 +----- .../src/components/Image/index.js | 6 +---- .../src/components/Link/index.js | 22 ------------------- .../src/components/Menu/index.js | 4 ---- .../Navigation/DesktopNavigation/index.js | 7 ------ .../src/components/Page/Base.js | 7 +----- .../src/components/Select/index.js | 20 ++++++++--------- .../src/components/SocialMediaIcons/index.js | 4 ---- .../src/components/Tabs/TabPanel.js | 7 ------ .../src/components/Tabs/index.js | 8 +++---- 30 files changed, 51 insertions(+), 204 deletions(-) diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/index.js b/apps/climatemappedafrica/src/components/DropdownSearch/index.js index 473626af5..b2c497290 100644 --- a/apps/climatemappedafrica/src/components/DropdownSearch/index.js +++ b/apps/climatemappedafrica/src/components/DropdownSearch/index.js @@ -64,11 +64,11 @@ const useStyles = makeStyles(({ palette, typography }) => ({ function DropdownSearch({ href: hrefProp = "/explore", label = "Search for a location", - counties = undefined, - onClick = undefined, + counties, + onClick, icon: iconProp = SearchIcon, - placeholder = undefined, - variant = undefined, + placeholder, + variant, ...props }) { const classes = useStyles(props); diff --git a/apps/climatemappedafrica/src/components/ExplorePage/index.js b/apps/climatemappedafrica/src/components/ExplorePage/index.js index 1032aa457..20c977918 100644 --- a/apps/climatemappedafrica/src/components/ExplorePage/index.js +++ b/apps/climatemappedafrica/src/components/ExplorePage/index.js @@ -21,12 +21,7 @@ function initialState(profiles, onClick) { }; } -function ExplorePage({ - panelProps = undefined, - profile: profileProp = undefined, - apiUri, - ...props -}) { +function ExplorePage({ panelProps, profile: profileProp, apiUri, ...props }) { const theme = useTheme(); const classes = useStyles(props); // NOTE: This setState and the corresponding useEffect are "hacks" since at diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js index 9e22051a8..6b04fec47 100644 --- a/apps/climatemappedafrica/src/components/Footer/index.js +++ b/apps/climatemappedafrica/src/components/Footer/index.js @@ -17,13 +17,13 @@ import Link from "@/climatemappedafrica/components/Link"; import Section from "@/climatemappedafrica/components/Section"; function Footer({ - title = undefined, - logoProps = undefined, + title, + logoProps, aboutVariant = "subtitle1", - description = undefined, - copyrightProps = undefined, - quickLinks: quickLinksProp = undefined, - socialMedia = undefined, + description, + copyrightProps, + quickLinks: quickLinksProp, + socialMedia, ...props }) { const classes = useStyles(props); diff --git a/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js index d06166023..7299564cb 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js @@ -36,10 +36,4 @@ CategoryHeader.propTypes = { icon: PropTypes.string, }; -CategoryHeader.defaultProps = { - title: undefined, - description: undefined, - icon: undefined, -}; - export default CategoryHeader; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js index 8edaf6f88..17827fdfa 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js @@ -164,12 +164,4 @@ Filters.propTypes = { }), }; -Filters.defaultProps = { - defaultFilters: undefined, - filterGroups: undefined, - filterSelectProps: undefined, - setFilterSelectProps: undefined, - view: undefined, -}; - export default Filters; diff --git a/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js b/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js index d37367e78..4184c340c 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js @@ -13,8 +13,8 @@ function ChartFilter({ onSelectAttribute, deleteFilter, index, - attributeText, - valueText, + attributeText = "Filter by attribute:", + valueText = "Select a value:", selectedAttribute: selectedAttributeProp, selectedValue: selectedValueProp, ...props @@ -161,8 +161,6 @@ ChartFilter.defaultProps = { onSelectAttribute: undefined, selectedValue: undefined, selectedAttribute: undefined, - attributeText: "Filter by attribute:", - valueText: "Select a value:", }; export default ChartFilter; diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js index 6e39bbc24..5257ff0e9 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js @@ -94,17 +94,4 @@ KeyMetric.propTypes = { parentFormattedValue: PropTypes.string, }; -KeyMetric.defaultProps = { - className: undefined, - color: undefined, - description: undefined, - displayFormat: undefined, - formattedValue: undefined, - metadata: undefined, - title: undefined, - value: undefined, - parentName: undefined, - parentFormattedValue: undefined, -}; - export default KeyMetric; diff --git a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js index 78d5f890a..75f584877 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js @@ -18,14 +18,7 @@ function SvgIcon(props) { return ; } -function LocationHeader({ - icon = undefined, - level = undefined, - onClick = undefined, - parent = undefined, - title = undefined, - ...props -}) { +function LocationHeader({ icon, level, onClick, parent, title, ...props }) { const classes = useStyles(props); if (!title) { diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js index 96afd0677..60404788e 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelButtons.js @@ -8,14 +8,14 @@ import useStyles from "./useStyles"; import PanelButtonGroup from "@/climatemappedafrica/components/HURUmap/PanelButtonGroup"; function PanelButtons({ - isPinning = undefined, - isCompare = undefined, - onClickPin = undefined, - onClickUnpin = undefined, - panelItems: panelItemsProp = undefined, - primaryProfile = undefined, - secondaryProfile = undefined, - drawerRef = undefined, + isPinning, + isCompare, + onClickPin, + onClickUnpin, + panelItems: panelItemsProp, + primaryProfile, + secondaryProfile, + drawerRef, ...props }) { const [value, setValue] = useState(); diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js index 7751a1f61..df3330c20 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/RichData.js @@ -6,7 +6,7 @@ import useStyles from "./useStyles"; import Profile from "@/climatemappedafrica/components/HURUmap/Panel/Profile"; import TreeView from "@/climatemappedafrica/components/HURUmap/TreeView"; -function RichData({ primaryProfile = undefined, ...props }) { +function RichData({ primaryProfile, ...props }) { const classes = useStyles(props); const profileRef = useRef(); diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/RichData.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/RichData.js index eac0b8c53..54eb279bb 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/RichData.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/RichData.js @@ -5,7 +5,7 @@ import SubcategoryList from "./SubcategoryList"; import Profile from "@/climatemappedafrica/components/HURUmap/Panel/Profile"; -function RichData({ item, ...props }) { +function RichData({ item, geography, ...props }) { return ( <> @@ -26,9 +26,4 @@ RichData.propTypes = { }), }; -RichData.defaultProps = { - item: undefined, - geography: undefined, -}; - export default RichData; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/SubcategoryList.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/SubcategoryList.js index 6fda944fb..2b8099f73 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/SubcategoryList.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/SubcategoryList.js @@ -119,8 +119,4 @@ SubcategoryList.propTypes = { items: PropTypes.arrayOf(PropTypes.shape({})), }; -SubcategoryList.defaultProps = { - items: undefined, -}; - export default SubcategoryList; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js index e93c593ca..dbeb6c405 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/index.js @@ -16,11 +16,7 @@ import { hurumapArgs } from "@/climatemappedafrica/config"; // eslint-disable-next-line import/order import useStyles from "./useStyles"; -function MobilePanel({ - scrollToTopLabel = undefined, - activeType = undefined, - ...props -}) { +function MobilePanel({ scrollToTopLabel, activeType, ...props }) { const classes = useStyles(props); const { onSelectLocation, primaryProfile, dataNotAvailable } = props; const { geography, items } = primaryProfile; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/Profile.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/Profile.js index 93be427aa..876e8542b 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/Profile.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/Profile.js @@ -195,16 +195,4 @@ Profile.propTypes = { }), }; -Profile.defaultProps = { - categories: undefined, - dataNotAvailable: undefined, - isLoading: undefined, - isPinning: undefined, - onClickPin: undefined, - onClickUnpin: undefined, - onSelectLocation: undefined, - primaryProfile: undefined, - secondaryProfile: undefined, -}; - export default Profile; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js index 453c4ab82..043bdb54f 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js @@ -252,14 +252,4 @@ ProfileItems.propTypes = { }), }; -ProfileItems.defaultProps = { - categories: undefined, - dataNotAvailable: undefined, - getSecondaryIndicator: undefined, - getSecondaryMetric: undefined, - geoCode: undefined, - primaryProfile: undefined, - secondaryProfile: undefined, -}; - export default ProfileItems; diff --git a/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js b/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js index f76e2fbf5..a13742c4f 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/PanelButtonGroup/index.js @@ -7,13 +7,7 @@ import React from "react"; import useStyles from "./useStyles"; -function PanelButtonGroup({ - items = undefined, - value = undefined, - onChange = undefined, - pins = [], - ...props -}) { +function PanelButtonGroup({ items, value, onChange, pins = [], ...props }) { const classes = useStyles(props); const handleChange = (_, selected) => { onChange(selected); diff --git a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js index 71f37a0c4..246941e8e 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js @@ -13,14 +13,14 @@ function PinIcon(props) { } function PinAndCompare({ - helperText = undefined, + helperText, isMobile = false, - currentGeographyCode = undefined, - locations = undefined, - onChange = undefined, - onClickPin = undefined, - onClose = undefined, - placeholder = undefined, + currentGeographyCode, + locations, + onChange, + onClickPin, + onClose, + placeholder, ...props }) { const classes = useStyles(props); diff --git a/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js index 51da431ba..b6c19ab3b 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js @@ -53,9 +53,4 @@ SubcategoryHeader.propTypes = { description: PropTypes.string, }; -SubcategoryHeader.defaultProps = { - title: undefined, - description: undefined, -}; - export default SubcategoryHeader; diff --git a/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js b/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js index dcaac9da5..61a6d2448 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/TreeView/index.js @@ -10,7 +10,7 @@ import useStyles from "./useStyles"; import { ReactComponent as CheckIcon } from "@/climatemappedafrica/assets/icons/checked.svg"; import slugify from "@/climatemappedafrica/utils/slugify"; -function TreeView({ items = undefined, onLabelClick = undefined, ...props }) { +function TreeView({ items, onLabelClick, ...props }) { const classes = useStyles(props); const [expanded, setExpanded] = useState(); diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js index f23120c7f..6fda6602e 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js @@ -77,12 +77,4 @@ TutorialStep.propTypes = { selector: PropTypes.string, }; -TutorialStep.defaultProps = { - description: undefined, - image: undefined, - onClose: undefined, - title: undefined, - selector: undefined, -}; - export default TutorialStep; diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js index 5d3734c2f..31bdc0b6e 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js @@ -27,12 +27,7 @@ const useStyles = makeStyles(({ typography, palette }) => ({ }, })); -function Tutorial({ - children = undefined, - defaultOpen = false, - items = [], - ...props -}) { +function Tutorial({ children, defaultOpen = false, items = [], ...props }) { const classes = useStyles(props); const { setIsOpen } = useTour(); setIsOpen(defaultOpen); diff --git a/apps/climatemappedafrica/src/components/Image/index.js b/apps/climatemappedafrica/src/components/Image/index.js index aafc6bf5b..af4a306df 100644 --- a/apps/climatemappedafrica/src/components/Image/index.js +++ b/apps/climatemappedafrica/src/components/Image/index.js @@ -2,11 +2,7 @@ import NImage from "next/image"; import PropTypes from "prop-types"; import React from "react"; -function Image({ - placeholder: placeholderProp = undefined, - src = undefined, - ...props -}) { +function Image({ placeholder: placeholderProp, src, ...props }) { if (!src) { return null; } diff --git a/apps/climatemappedafrica/src/components/Link/index.js b/apps/climatemappedafrica/src/components/Link/index.js index 2429b27d3..59db32605 100644 --- a/apps/climatemappedafrica/src/components/Link/index.js +++ b/apps/climatemappedafrica/src/components/Link/index.js @@ -52,18 +52,6 @@ NextComposed.propTypes = { shallow: PropTypes.bool, }; -NextComposed.defaultProps = { - as: undefined, - component: undefined, - href: undefined, - locale: undefined, - passHref: undefined, - prefetch: undefined, - replace: undefined, - scroll: undefined, - shallow: undefined, -}; - // A styled version of the Next.js Link component: // https://nextjs.org/docs/api-reference/next/link/ const Link = forwardRef(function Link(props, ref) { @@ -142,14 +130,4 @@ Link.propTypes = { prefetch: PropTypes.bool, }; -Link.defaultProps = { - activeClassName: undefined, - as: undefined, - className: undefined, - href: undefined, - naked: undefined, - onClick: undefined, - prefetch: undefined, -}; - export default Link; diff --git a/apps/climatemappedafrica/src/components/Menu/index.js b/apps/climatemappedafrica/src/components/Menu/index.js index 8fcb59481..003842c48 100644 --- a/apps/climatemappedafrica/src/components/Menu/index.js +++ b/apps/climatemappedafrica/src/components/Menu/index.js @@ -154,8 +154,4 @@ Menu.propTypes = { children: PropTypes.node, }; -Menu.defaultProps = { - children: undefined, - socialLinks: undefined, -}; export default Menu; diff --git a/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js index 719e8490b..b331ac243 100644 --- a/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js +++ b/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js @@ -69,11 +69,4 @@ DesktopNavigation.propTypes = { }), }; -DesktopNavigation.defaultProps = { - logoProps: undefined, - menuProps: undefined, - socialLinks: undefined, - desktopLogoProps: undefined, -}; - export default DesktopNavigation; diff --git a/apps/climatemappedafrica/src/components/Page/Base.js b/apps/climatemappedafrica/src/components/Page/Base.js index 3986a8a29..81deae626 100644 --- a/apps/climatemappedafrica/src/components/Page/Base.js +++ b/apps/climatemappedafrica/src/components/Page/Base.js @@ -13,12 +13,7 @@ import getNavigationMenu from "@/climatemappedafrica/functions/menus/getNavigati /** * Base page that can be used to build all other pages. */ -function BasePage({ - children = undefined, - menus = undefined, - variant = undefined, - ...props -}) { +function BasePage({ children, menus, variant, ...props }) { const seo = {}; const footerProps = getFooterMenu(menus?.footerMenu || []); const navigation = getNavigationMenu(menus?.primaryMenu || []); diff --git a/apps/climatemappedafrica/src/components/Select/index.js b/apps/climatemappedafrica/src/components/Select/index.js index d81baaa0e..a90540397 100644 --- a/apps/climatemappedafrica/src/components/Select/index.js +++ b/apps/climatemappedafrica/src/components/Select/index.js @@ -21,16 +21,16 @@ function ExpandMoreIcon(props) { } function Input({ - disabled = undefined, - helperText = undefined, - label: labelProp = undefined, - onChange = undefined, - onOpen = undefined, - onClose = undefined, - open = undefined, - options = undefined, - selected = undefined, - placeholder = undefined, + disabled, + helperText, + label: labelProp, + onChange, + onOpen, + onClose, + open, + options, + selected, + placeholder, ...props }) { const classes = useStyles(props); diff --git a/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js b/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js index 06769049b..2b02c0b61 100644 --- a/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js +++ b/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js @@ -85,8 +85,4 @@ SocialMediaIcons.propTypes = { ), }; -SocialMediaIcons.defaultProps = { - socialLinks: undefined, -}; - export default SocialMediaIcons; diff --git a/apps/climatemappedafrica/src/components/Tabs/TabPanel.js b/apps/climatemappedafrica/src/components/Tabs/TabPanel.js index 9451c8172..b815e2aab 100644 --- a/apps/climatemappedafrica/src/components/Tabs/TabPanel.js +++ b/apps/climatemappedafrica/src/components/Tabs/TabPanel.js @@ -30,11 +30,4 @@ TabPanel.propTypes = { selected: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), }; -TabPanel.defaultProps = { - children: undefined, - value: undefined, - name: undefined, - selected: undefined, -}; - export default TabPanel; diff --git a/apps/climatemappedafrica/src/components/Tabs/index.js b/apps/climatemappedafrica/src/components/Tabs/index.js index a888a3894..011bf7b81 100644 --- a/apps/climatemappedafrica/src/components/Tabs/index.js +++ b/apps/climatemappedafrica/src/components/Tabs/index.js @@ -16,10 +16,10 @@ function a11yProps(name, index) { function Tabs({ activeTab = 0, - items = undefined, - name: nameProp = undefined, - onChange = undefined, - linkComponent = undefined, + items, + name: nameProp, + onChange, + linkComponent, ...props }) { const router = useRouter(); From 33886c7f37552af6e4ffab0336c42c50e20f1c8f Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Thu, 29 Aug 2024 15:37:25 +0300 Subject: [PATCH 07/12] Update apps/climatemappedafrica/src/components/Navigation/index.js Yes, I agree. Initially, I thought moving everything from defaultProps to the function parameters would add value, but I later realized it was unnecessary verbosity. Looks like I forgot to change this one ! Co-authored-by: KEVIN KOECH --- apps/climatemappedafrica/src/components/Navigation/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/climatemappedafrica/src/components/Navigation/index.js b/apps/climatemappedafrica/src/components/Navigation/index.js index 72eaebbdf..866c319f1 100644 --- a/apps/climatemappedafrica/src/components/Navigation/index.js +++ b/apps/climatemappedafrica/src/components/Navigation/index.js @@ -28,7 +28,7 @@ const useStyles = makeStyles( }), ); -function Navigation({ variant = undefined, ...props }) { +function Navigation({ variant, ...props }) { const classes = useStyles(props); return ( From 437c8d42de17b139b1fd7885728a56801c380014 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Thu, 29 Aug 2024 15:42:29 +0300 Subject: [PATCH 08/12] chore: Remove explicit default type for Section component --- apps/climatemappedafrica/src/components/Section/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/climatemappedafrica/src/components/Section/index.js b/apps/climatemappedafrica/src/components/Section/index.js index b14488b59..9b980d468 100644 --- a/apps/climatemappedafrica/src/components/Section/index.js +++ b/apps/climatemappedafrica/src/components/Section/index.js @@ -21,7 +21,7 @@ const useStyles = makeStyles(({ breakpoints, typography, widths }) => ({ }, {}), })); -function Section({ className = undefined, fixed = true, ...props }) { +function Section({ className, fixed = true, ...props }) { const classes = useStyles(props); return ( From 2b3e86c90c60cb27960e4349d56d4ee374447c0a Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Fri, 30 Aug 2024 11:23:29 +0300 Subject: [PATCH 09/12] Update apps/climatemappedafrica/src/components/Page/index.js Co-authored-by: Clemence Kyara --- apps/climatemappedafrica/src/components/Page/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/climatemappedafrica/src/components/Page/index.js b/apps/climatemappedafrica/src/components/Page/index.js index 1de1d1e3e..4d32d3f87 100644 --- a/apps/climatemappedafrica/src/components/Page/index.js +++ b/apps/climatemappedafrica/src/components/Page/index.js @@ -7,7 +7,7 @@ import Base from "./Base"; * Page component that adds error handling. * TODO(kilemensi): Add error handling once we have error page designs */ -function Page({ ...props }) { +function Page(props) { return ; } From 0feba228bef9fb061012630b12b61331bc6546a4 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Fri, 30 Aug 2024 11:32:18 +0300 Subject: [PATCH 10/12] fix: Use undefined as default type for Tutorial/index.js --- .../src/components/HURUmap/Tutorial/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js index 31bdc0b6e..49f334e16 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js @@ -27,7 +27,7 @@ const useStyles = makeStyles(({ typography, palette }) => ({ }, })); -function Tutorial({ children, defaultOpen = false, items = [], ...props }) { +function Tutorial({ children, defaultOpen = false, items, ...props }) { const classes = useStyles(props); const { setIsOpen } = useTour(); setIsOpen(defaultOpen); From 3371f87b903d634a0330ffaec6d71e82c737538c Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Fri, 30 Aug 2024 11:35:26 +0300 Subject: [PATCH 11/12] Update apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js Co-authored-by: Clemence Kyara --- .../src/components/HURUmap/Panel/DesktopPanel/PanelItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js index a6b7162e8..d17a0ce78 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js @@ -3,7 +3,7 @@ import React from "react"; import RichData from "./RichData"; -function PanelItem({ item = undefined, ...props }) { +function PanelItem({ item, ...props }) { const key = item.value; switch (key) { case "rich-data": // fallthrough From f25e0fc0b1cb581ddcc08efa70da3f25cafc8e8b Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Fri, 30 Aug 2024 11:49:33 +0300 Subject: [PATCH 12/12] fix: Improve function definitions in PanelItem and MobileNavigation --- .../components/HURUmap/Panel/DesktopPanel/PanelItem.js | 2 +- .../src/components/Navigation/MobileNavigation/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js index a6b7162e8..d17a0ce78 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/DesktopPanel/PanelItem.js @@ -3,7 +3,7 @@ import React from "react"; import RichData from "./RichData"; -function PanelItem({ item = undefined, ...props }) { +function PanelItem({ item, ...props }) { const key = item.value; switch (key) { case "rich-data": // fallthrough diff --git a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js index a277df2d8..b7f5343f6 100644 --- a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js +++ b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js @@ -158,11 +158,11 @@ const Transition = React.forwardRef(function Transition(props, ref) { }); function MobileNavigation({ - drawerLogoProps = undefined, + drawerLogoProps, href = "/explore", - menuProps = undefined, - mobileLogoProps = undefined, - socialLinks = undefined, + menuProps, + mobileLogoProps, + socialLinks, logoProps, ...props }) {