-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Continue Create Dropdown Options #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
trillium
wants to merge
21
commits into
timlrx:main
Choose a base branch
from
trillium:ts.continue_feature_dropdown
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0389375
feat: Refactor menu items with { active } to use headlessui highlighting
trillium 0d6b12f
feat: Switch to headerNavLinks import for NavOptions
trillium 402722b
feat: Update object structure to inlcude "children" prop
trillium a21945a
feat: Create type NavItem for headerNavLinks
trillium 818c645
feat: Import NavItem type into NavOptions
trillium 2424104
feat: Create RenderNavLinks helper function
trillium fdd1ce8
feat: Use helper function in NavOptions .map()
trillium 478321f
feat: Create NavItemChild type, add to NavItem type
trillium 6af7466
feat: Add NavItemChild import
trillium fd96713
feat: Add { active } to RenderNavLink, highlighting for dropdown
trillium bccdbb1
feat: Add { NavOptions } import to Header.tsx
trillium 88a7710
feat: Remove headerNavLinks from Header.tsx
trillium 23a983a
fix: Restore nav links highlighting
trillium 17f0c22
feat: Create RenderMobileNavLink helper func
trillium b4b89b5
feat: Import types form headerNavLinks
trillium b301981
feat: Render links with heperFunc
trillium 959bc72
fix: Force href to be '' if no href is supplied in Link
trillium 6cee124
Merge remote-tracking branch 'upstream/main' into ts.continue_feature…
trillium fd6f4a0
feat: Update NavLinks types
trillium 0789274
feat: Move NavLink type to NavOptions
trillium 792067c
fix: Update RenderMobileNavLinkProps
trillium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| 'use client' | ||
|
|
||
| import { Fragment, useEffect, useState } from 'react' | ||
| import { useTheme } from 'next-themes' | ||
| import { Menu, RadioGroup, Transition } from '@headlessui/react' | ||
| import headerNavLinks, { NavItem, NavItemChild } from '@/data/headerNavLinks' | ||
| import Link from 'next/link' | ||
|
|
||
| export const NavOptions = () => { | ||
| return ( | ||
| <> | ||
| {headerNavLinks | ||
| .filter((link) => link.href !== '/') | ||
| .map((link) => ( | ||
| <RenderNavLink navItem={link} key={link.title} /> | ||
| ))} | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| const RenderNavLink = ({ navItem }: { navItem: NavItem }) => { | ||
| if (!navItem.children) { | ||
| return ( | ||
| <Link | ||
| key={navItem.title} | ||
| href={navItem.href} | ||
| className="hidden font-medium text-gray-900 hover:text-primary-500 dark:text-gray-100 dark:hover:text-primary-400 sm:block" | ||
| > | ||
| {navItem.title} | ||
| </Link> | ||
| ) | ||
| } | ||
| return ( | ||
| <div className="mr-5"> | ||
| <Menu as="div" className="relative inline-block text-left"> | ||
| <div> | ||
| {navItem.title && ( | ||
| <Menu.Button | ||
| className={ | ||
| 'hidden font-medium text-gray-900 hover:text-primary-500 dark:text-gray-100 dark:hover:text-primary-400 sm:block' | ||
| } | ||
| > | ||
| {navItem.title} | ||
| </Menu.Button> | ||
| )} | ||
| </div> | ||
| <Transition | ||
| as={Fragment} | ||
| enter="transition ease-out duration-100" | ||
| enterFrom="transform opacity-0 scale-95" | ||
| enterTo="transform opacity-100 scale-100" | ||
| leave="transition ease-in duration-75" | ||
| leaveFrom="transform opacity-100 scale-100" | ||
| leaveTo="transform opacity-0 scale-95" | ||
| > | ||
| <Menu.Items className="absolute right-0 mt-2 w-32 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-gray-800"> | ||
| <div className="p-1"> | ||
| {navItem.children && | ||
| navItem.children.map((link: NavItemChild) => ( | ||
| <Menu.Item key={link.title}> | ||
| {({ active }) => ( | ||
| <Link | ||
| href={link.href} | ||
| className={`${ | ||
| active ? 'bg-primary-600 text-white' : '' | ||
| } group flex w-full items-center rounded-md px-2 py-2 text-sm`} | ||
| > | ||
| {link.title} | ||
| </Link> | ||
| )} | ||
| </Menu.Item> | ||
| ))} | ||
| </div> | ||
| </Menu.Items> | ||
| </Transition> | ||
| </Menu> | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.