-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ButtonMenu - InputMenu - Button/AnchorButton leadingIcon/trailingIcon props - useRandomId hook - utils for DOM walking
- Loading branch information
Showing
27 changed files
with
690 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ButtonMenu, Card } from "ninjakit"; | ||
import { FunctionComponent } from "react"; | ||
import { MdMenu } from "react-icons/md"; | ||
|
||
import { useMenuItems } from "./menu-items"; | ||
|
||
export const ButtonMenuExamples: FunctionComponent = () => { | ||
const menuItems = useMenuItems(); | ||
|
||
return ( | ||
<Card appearance="elevated" id="button-menu" title="ButtonMenu"> | ||
<section> | ||
<ButtonMenu | ||
label="Filled" | ||
onChange={({ currentTarget: { value } }) => | ||
console.info("ButtonMenu", { value }) | ||
} | ||
> | ||
{menuItems} | ||
</ButtonMenu> | ||
<ButtonMenu | ||
appearance="text" | ||
label="Text" | ||
onChange={({ currentTarget: { value } }) => | ||
console.info("ButtonMenu", { value }) | ||
} | ||
> | ||
{menuItems} | ||
</ButtonMenu> | ||
<ButtonMenu | ||
appearance="text" | ||
leadingIcon={<MdMenu />} | ||
onChange={({ currentTarget: { value } }) => | ||
console.info("ButtonMenu", { value }) | ||
} | ||
> | ||
{menuItems} | ||
</ButtonMenu> | ||
</section> | ||
</Card> | ||
); | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Card, InputMenu } from "ninjakit"; | ||
import { FunctionComponent } from "react"; | ||
|
||
import { useMenuItems } from "./menu-items"; | ||
|
||
export const InputMenuExamples: FunctionComponent = () => { | ||
const menuItems = useMenuItems(); | ||
|
||
return ( | ||
<Card appearance="elevated" id="menu" title="InputMenu"> | ||
<section> | ||
<InputMenu | ||
label="Filled" | ||
onChange={({ currentTarget: { value } }) => | ||
console.info("InputMenu", { value }) | ||
} | ||
> | ||
{menuItems} | ||
</InputMenu> | ||
<InputMenu | ||
appearance="outlined" | ||
label="Outlined" | ||
onChange={({ currentTarget: { value } }) => | ||
console.info("InputMenu", { value }) | ||
} | ||
> | ||
{menuItems} | ||
</InputMenu> | ||
</section> | ||
</Card> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { MenuItem, useRandomId } from "ninjakit"; | ||
|
||
export const useMenuItems = () => { | ||
const randomId = useRandomId(); | ||
|
||
return [ | ||
{ label: "Item One", value: "item-one" }, | ||
{ label: "Item Two", value: "item-two" }, | ||
{ disabled: true, label: "Item Three", value: "item-three" }, | ||
{ separator: true }, | ||
{ label: "Item Four", value: "item-four" }, | ||
{ label: "Item Five", value: "item-five" }, | ||
{ label: "Item Six", value: "item-six" }, | ||
{ label: "Item Seven", value: "item-seven" }, | ||
{ label: "Item Eight", value: "item-eight" }, | ||
{ label: "Item Nine", value: "item-nine" }, | ||
{ label: "Item Ten", value: "item-ten" }, | ||
].map(({ disabled, label, separator, value }) => { | ||
return ( | ||
<MenuItem | ||
disabled={disabled} | ||
key={`${randomId}-${value}`} | ||
separator={separator} | ||
value={value} | ||
> | ||
{label} | ||
</MenuItem> | ||
); | ||
}); | ||
}; |
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
Oops, something went wrong.