diff --git a/components/Chart.js b/components/Chart.js index df7d1dd4..887e6c46 100644 --- a/components/Chart.js +++ b/components/Chart.js @@ -95,16 +95,13 @@ const Chart = memo(function Chart({ )} {error && ( -
- - Error: {error.message} - -
{JSON.stringify(error, null, 2)}
-
- +
+ + Error: {error.message} + +
{JSON.stringify(error, null, 2)}
+
} /> )} diff --git a/components/ConditionalWrapper.js b/components/ConditionalWrapper.js new file mode 100644 index 00000000..19dd698f --- /dev/null +++ b/components/ConditionalWrapper.js @@ -0,0 +1,12 @@ +// import type { ReactNode } from 'react' + +// type ConditionalWrapperProps = { +// condition: boolean +// wrapper: (children: ReactNode) => ReactNode +// children: ReactNode +// } + +const ConditionalWrapper = ({ condition, wrapper, children }) => + condition ? wrapper(children) : children + +export default ConditionalWrapper diff --git a/components/DomainChart.js b/components/DomainChart.js index 44c7a067..bbb7db30 100644 --- a/components/DomainChart.js +++ b/components/DomainChart.js @@ -75,16 +75,13 @@ const Chart = memo(function Chart({ queryParams = {}, setState }) { {error && ( -
- - Error: {error.message} - -
{JSON.stringify(error, null, 2)}
-
- +
+ + Error: {error.message} + +
{JSON.stringify(error, null, 2)}
+
} /> )} diff --git a/components/Layout.js b/components/Layout.js index 1b497263..39eac94a 100644 --- a/components/Layout.js +++ b/components/Layout.js @@ -4,11 +4,12 @@ import { useMemo } from 'react' import { StyledStickyNavBar } from 'components/SharedStyledComponents' import { UserProvider } from 'hooks/useUser' import { useRouter } from 'next/router' +import ConditionalWrapper from './ConditionalWrapper' import Footer from './Footer' import Header from './Header' import NavBar from './NavBar' -const Layout = ({ children }) => { +const Layout = ({ children, isEmbeddedView }) => { const { pathname } = useRouter() const navbarColor = useMemo(() => { @@ -31,23 +32,28 @@ const Layout = ({ children }) => { return ( -
+
- {navbarSticky ? ( - + {!isEmbeddedView && ( + ( + {children} + )} + > - - ) : ( - + )}
{children}
-
-
-
+ {!isEmbeddedView && ( +
+
+
+ )}
) diff --git a/components/NavBar.js b/components/NavBar.js index a459e0f8..20cda3fb 100644 --- a/components/NavBar.js +++ b/components/NavBar.js @@ -182,7 +182,7 @@ export const NavBar = ({ color }) => {
)}
a]:border-black [&>a]:hover:border-black [&>*]:opacity-100 [&>*]:text-black [&>*]:hover:text-black'}`} + className={`flex gap-4 lg:gap-8 text-sm ${showMenu && 'pt-2 flex-col items-start [&>a]:border-black [&>a]:hover:border-black [&>*]:opacity-100 [&>*]:text-black [&>*]:hover:text-black'}`} > } diff --git a/components/SocialButtons.js b/components/SocialButtons.js index d3306373..566c25dc 100644 --- a/components/SocialButtons.js +++ b/components/SocialButtons.js @@ -6,9 +6,9 @@ const SocialButtons = ({ url }) => { const intl = useIntl() return ( -
+
-
+
{intl.formatMessage( { id: 'SocialButtons.CTA' }, { diff --git a/components/aggregation/mat/Filters.js b/components/aggregation/mat/Filters.js index 68f7a22d..8e72cd8c 100644 --- a/components/aggregation/mat/Filters.js +++ b/components/aggregation/mat/Filters.js @@ -312,10 +312,7 @@ const Filters = ({ data = [], tableData, setDataForCharts, query }) => { }) return ( - +