Skip to content
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

feat(components): use button for disclosure nav item #69

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/components/navigation/navigation-disclosure-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from "react";
import { Disclosure } from "@headlessui/react";
import { classNames } from "../../util/class-names";

export interface NavigationDisclosurePanelItemProps {
children: React.ReactNode;
export interface NavigationDisclosurePanelItemProps
extends React.ComponentPropsWithoutRef<"button"> {
isActive?: boolean;
isIndented?: boolean;
}
Expand All @@ -12,20 +12,23 @@ const NavigationDisclosurePanelItem = ({
children,
isActive,
isIndented,
...props
}: NavigationDisclosurePanelItemProps) => {
return (
<div
<button
type="button"
className={classNames(
"relative w-full px-8 py-3 text-left text-sm text-neutral-0 hover:bg-primary-900+10",
isIndented && "px-14",
isActive && "bg-primary-900+20 font-semibold hover:bg-primary-900+20"
)}
{...props}
>
{children}
{isActive && (
<div className="absolute bottom-0 left-0 top-0 h-full w-0.5 rounded-r-sm bg-neutral-0" />
)}
</div>
</button>
);
};

Expand Down
Loading