-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add zIndex and appendTo props to ControlledPopover.
- NavBarPopoverButton now toggles the popover, so if the user clicks it when it is open, it closes. - NavBarButton now forwards ref, so that it works with Popover anchoring.
- Loading branch information
1 parent
c04ae01
commit 5d10640
Showing
3 changed files
with
35 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { FlatButton, FlatButtonProps } from "@stenajs-webui/elements"; | ||
import * as React from "react"; | ||
import { forwardRef } from "react"; | ||
import cx from "classnames"; | ||
import styles from "./NavBarButton.module.css"; | ||
|
||
export interface NavBarButtonProps extends FlatButtonProps { | ||
selected?: boolean; | ||
} | ||
|
||
export const NavBarButton: React.FC<NavBarButtonProps> = ({ | ||
selected, | ||
className, | ||
...buttonProps | ||
}) => { | ||
return ( | ||
<FlatButton | ||
{...buttonProps} | ||
className={cx( | ||
styles.navBarButton, | ||
selected && styles.selected, | ||
className | ||
)} | ||
/> | ||
); | ||
}; | ||
export const NavBarButton = forwardRef<HTMLButtonElement, NavBarButtonProps>( | ||
function ({ selected, className, ...buttonProps }, ref) { | ||
return ( | ||
<FlatButton | ||
{...buttonProps} | ||
ref={ref} | ||
className={cx( | ||
styles.navBarButton, | ||
selected && styles.selected, | ||
className | ||
)} | ||
/> | ||
); | ||
} | ||
); |
This file contains 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 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