Skip to content

Commit

Permalink
Merge pull request #461 from Dark-Matter-Labs/staging
Browse files Browse the repository at this point in the history
Merge new themes and some query refactoring
  • Loading branch information
theocampbell authored Feb 9, 2024
2 parents 16023a0 + ba26f2f commit 172de0f
Show file tree
Hide file tree
Showing 35 changed files with 1,402 additions and 1,047 deletions.
7 changes: 6 additions & 1 deletion components/instrument/instrument-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export default function InstrumentHeader({ data }) {
const [simpleThema, setSimpleThema] = useState();

useEffect(() => {
if (router.pathname.includes('meubels') || router.pathname.includes('woningen')) {
if (
router.pathname.includes('meubels') ||
router.pathname.includes('woningen') ||
router.pathname.includes('kunstgrasvelden') ||
router.pathname.includes('eiwittransitie')
) {
setSimpleThema(true);
} else {
setSimpleThema(false);
Expand Down
8 changes: 4 additions & 4 deletions components/layouts/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ export default function Layout({
}) {
const { data: aboutPageSlugs } = useSWR(groq`${siteSettingsQuerys.overCirulaw}`, fetcher);
const { data: vraagAntwoordSlug } = useSWR(groq`${siteSettingsQuerys.vraagAntwoord}`, fetcher);
const { data: themaPageSlugs } = useSWR(groq`${siteSettingsQuerys.thema}`, fetcher);
// const { data: themaPageSlugs } = useSWR(groq`${siteSettingsQuerys.thema}`, fetcher);
const { data: footerTextData } = useSWR(groq`${footerQuery}`, fetcher);
const footerText = footerTextData;
const aboutNavItems = aboutPageSlugs;
const vraagSlug = vraagAntwoordSlug?.slug;
const themaSlugs = themaPageSlugs?.slugs;
// const themaSlugs = themaPageSlugs?.slugs;

return (
<>
<Nav
vraagSlug={vraagSlug}
aboutSlugs={aboutNavItems}
themaSlugs={themaSlugs}
// themaSlugs={themaSlugs}
homePageHeader={homePageHeader}
/>
<Head>
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function Layout({
<Footer
vraagSlug={vraagSlug}
aboutSlugs={aboutNavItems}
themaSlugs={themaSlugs}
// themaSlugs={themaSlugs}
footerText={footerText}
/>
</>
Expand Down
12 changes: 2 additions & 10 deletions components/layouts/measures-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { useState, useEffect, useRef, Fragment, useCallback } from 'react';
import { Dialog, Transition, Combobox } from '@headlessui/react';
import createPersistedState from 'use-persisted-state';
import { SearchIcon, XIcon, AdjustmentsIcon } from '@heroicons/react/outline';
import { groq } from 'next-sanity';
import { toPlainText } from '@portabletext/react';
import Fuse from 'fuse.js';
import useSWR from 'swr';

import {
overheidslaag,
Expand All @@ -17,15 +15,13 @@ import {
} from '@/utils/data-filter';
import SearchFilter from '/components/search-filter';
import PolicyList from '/components/policy-list';
import { fetcher } from '@/utils/swr-fetcher';
import { measureLayoutQuery } from '@/lib/queries';
import OverviewPageHeader from '../overview-page-header';
// creating objects for persisting values
const useSelectedState = createPersistedState('selected');

export default function MeasuresLayout({ ...props }) {
// TODO: import the data staticly with getStaticProps when we implement link structure changes
const { data } = useSWR(groq`${measureLayoutQuery}`, fetcher);
const data = props.instruments;

// creating references to access child component functions
const expertiseFilterRef = useRef();
const wettelijkFilterRef = useRef();
Expand Down Expand Up @@ -132,10 +128,6 @@ export default function MeasuresLayout({ ...props }) {
// added check for data to have been retrieved here
if (data) {
let filteredLaws = data;
// filter for thema
filteredLaws = filteredLaws?.filter((element) => {
return element.thema === props.thema;
});

filteredLaws?.map((law) => {
if (law.expertise[0] === true) {
Expand Down
5 changes: 2 additions & 3 deletions components/layouts/simple-thema-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import InstrumentMetaData from '../instrument/instrument-metadata';
import ThemePageHeader from '@/components/theme-page/theme-page-header';
import ThemePageHeaderMobile from '../theme-page/theme-page-header-mobile';

export default function SimpleThemaLayout({ instruments, numberOfLaws, subheading, ...props }) {
export default function SimpleThemaLayout({ instruments, numberOfLaws, ...props }) {
const themaData = props.thema;

return (
<>
{/* HEADER DESKTOP */}
Expand All @@ -17,7 +16,7 @@ export default function SimpleThemaLayout({ instruments, numberOfLaws, subheadin
<div className='global-margin'>
<div className='max-w-[830px] mb-10'>
<h2 className='p-5xl-semibold pb-4 pt-7'>
First {numberOfLaws} {subheading}
Eerste {numberOfLaws} {themaData.introTextTitle}
</h2>
<p>{themaData?.introText}</p>
</div>
Expand Down
2 changes: 2 additions & 0 deletions components/nav/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const navigation = {
{ name: 'Windturbines', slug: '/maakindustrie/windturbines' },
{ name: 'Woningen', slug: '/bouw/woningen' },
{ name: 'Meubels', slug: '/consumptie-goederen/meubels' },
{ name: 'Eiwittransitie', slug: '/biomassa-en-voedsel/eiwittransitie' },
{ name: 'Kunstgrasvelden', slug: '/kunststoffen/kunstgrasvelden' },
],
};

Expand Down
37 changes: 10 additions & 27 deletions components/nav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,10 @@ const maakindustrieThemas = [{ name: 'Windturbines', url: '/maakindustrie/windtu

const biomassaEnVoedselThemas = [
{ name: 'Voedselverspilling', url: '/biomassa-en-voedsel/voedselverspilling' },
{ name: 'Eiwittransitie', url: '/biomassa-en-voedsel/eiwittransitie' },
];

{
/*
const kunststoffenThemas = [
{ name: 'Plastic in de bouw', url: '/kunststoffen/plastic-in-de-bouw' },
];*/
}
const kunststoffenThemas = [{ name: 'Kunstgrasvelden', url: '/kunststoffen/kunstgrasvelden' }];

export default function Nav3(props) {
const router = useRouter();
Expand Down Expand Up @@ -373,9 +369,10 @@ export default function Nav3(props) {
transitionAgenda='Maakindustrie'
themas={maakindustrieThemas}
/>
<li className='p-base-semibold text-green-800 py-6 border-b opacity-75'>
Kunststoffen
</li>
<MobileDisclosure
transitionAgenda='Kunststoffen'
themas={kunststoffenThemas}
/>
</ul>
</Disclosure.Panel>
</Transition>
Expand Down Expand Up @@ -512,24 +509,10 @@ export default function Nav3(props) {
transitionAgenda='Maakindustrie'
themas={maakindustrieThemas}
/>
<div
className={`${
router.pathname === '/'
? 'bg-green-600 text-gray-100 opacity-80'
: 'bg-grey-100 text-green-800 text-opacity-75'
} w-full flex flex-col pl-3 lg:pl-6 pt-8 pr-2`}
>
<div className='p-lg-semibold '>Kunststoffen</div>
<div className=''>
<div
className={`${
router.pathname === '/' ? 'text-gray-100' : 'text-gray-600'
} p-xs mt-2 italic`}
>
Thema’s voor deze productketen volgen binnenkort
</div>
</div>
</div>
<DesktopNavCard
transitionAgenda='Kunststoffen'
themas={kunststoffenThemas}
/>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 172de0f

Please sign in to comment.