From 4ab65e0bd988278d2315eb170163cb69f5ea1f10 Mon Sep 17 00:00:00 2001 From: nofurtherinformation Date: Fri, 29 Mar 2024 16:05:45 -0500 Subject: [PATCH] nav updates --- components/Nav/Renderer.tsx | 39 ++++++++++++++++++---------------- components/Nav/SubNavList.tsx | 40 +++++++++++++++++++++++++++++++++++ content/nav/main-nav.mdx | 10 +++++++++ tailwind.config.js | 28 ++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 components/Nav/SubNavList.tsx diff --git a/components/Nav/Renderer.tsx b/components/Nav/Renderer.tsx index 3be41c3..0278906 100644 --- a/components/Nav/Renderer.tsx +++ b/components/Nav/Renderer.tsx @@ -1,3 +1,4 @@ +import { SubNavList } from "./SubNavList" import { NavProps } from "./types" export const NavRenderer: React.FC = ({ navInfo }) => { @@ -10,24 +11,26 @@ export const NavRenderer: React.FC = ({ navInfo }) => {

{navInfo.data.nav.title}

    - {links.map((link, li) => ( -
  • - {link.title} - {link.subLinks && ( -
    -
      - {link.subLinks.map((subLink, sli) => { - return ( -
    • - {subLink.title} -
    • - ) - })} -
    -
    - )} -
  • - ))} + {links.map((link, li) => { + // @ts-ignore + if (link.sublinks?.length > 0) { + return ( +
  • + +
  • + ) + } else { + return ( +
  • + {link.title} +
  • + ) + } + })}
diff --git a/components/Nav/SubNavList.tsx b/components/Nav/SubNavList.tsx new file mode 100644 index 0000000..1b95c4f --- /dev/null +++ b/components/Nav/SubNavList.tsx @@ -0,0 +1,40 @@ +"use client" +import * as DropdownMenu from "@radix-ui/react-dropdown-menu" +import { ChevronDownIcon } from "@radix-ui/react-icons" +import { LinkSpec } from "./types" + +export const SubNavList: React.FC<{ title: string, subLinks: Array }> = ({ title, subLinks }) => { + return ( + + + + + + + {subLinks.map((link, li) => { + return ( + + + {link.title} + + + ) + })} + + + + ) +} \ No newline at end of file diff --git a/content/nav/main-nav.mdx b/content/nav/main-nav.mdx index ca6b9c0..a5a185a 100644 --- a/content/nav/main-nav.mdx +++ b/content/nav/main-nav.mdx @@ -7,6 +7,16 @@ links: path: / - title: Map path: /map + - title: Reports + sublinks: + - title: National + path: /reports/national + - title: State + path: /reports/state + - title: County + path: /reports/county + - title: Neighborhood + path: /reports/tract - title: Case Studies path: /case-studies - title: Resources diff --git a/tailwind.config.js b/tailwind.config.js index 2e0f33e..41d0201 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -2,6 +2,7 @@ const { pick, omit } = require("lodash") const colors = require("tailwindcss/colors") const defaultTheme = require("tailwindcss/defaultTheme") +const { blackA, mauve, violet } = require('@radix-ui/colors'); /** @type {import('tailwindcss').Config} */ module.exports = { @@ -17,6 +18,9 @@ module.exports = { theme: { extend: { colors: { + ...blackA, + ...mauve, + ...violet, primary: { 50: "#eff6ff", 100: "#dbeafe", @@ -66,6 +70,30 @@ module.exports = { "Noto Color Emoji", ], }, + keyframes: { + slideDownAndFade: { + from: { opacity: '0', transform: 'translateY(-2px)' }, + to: { opacity: '1', transform: 'translateY(0)' }, + }, + slideLeftAndFade: { + from: { opacity: '0', transform: 'translateX(2px)' }, + to: { opacity: '1', transform: 'translateX(0)' }, + }, + slideUpAndFade: { + from: { opacity: '0', transform: 'translateY(2px)' }, + to: { opacity: '1', transform: 'translateY(0)' }, + }, + slideRightAndFade: { + from: { opacity: '0', transform: 'translateX(-2px)' }, + to: { opacity: '1', transform: 'translateX(0)' }, + }, + }, + animation: { + slideDownAndFade: 'slideDownAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)', + slideLeftAndFade: 'slideLeftAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)', + slideUpAndFade: 'slideUpAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)', + slideRightAndFade: 'slideRightAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)', + }, borderWidth: { DEFAULT: "1px", 0: "0",