Skip to content

Commit

Permalink
Merge pull request #69 from abusix/pla-885-use-button-instead-of-div-…
Browse files Browse the repository at this point in the history
…for-disclosure-nav-items

feat(components): use button for disclosure nav item
  • Loading branch information
mnlfischer authored Dec 8, 2023
2 parents e6768d3 + eb1ac62 commit f76f198
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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

0 comments on commit f76f198

Please sign in to comment.