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
| import { | |
| useTreeState, | |
| Tree, | |
| TreeItem, | |
| TreeGroup, | |
| TreeGroupLabel, | |
| } from "ariakit/tree"; | |
| function TreeView() { | |
| const state = useTreeState({ defaultExpandedIds: ["item-1"] }); |
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
| import * as React from "react"; | |
| import { FixedSizeList as List, areEqual } from "react-window"; | |
| import chunk from "lodash/chunk"; | |
| import { | |
| usePopoverState, | |
| PopoverDisclosure, | |
| Button, | |
| PopoverDisclosureHTMLProps, | |
| } from "reakit"; | |
| import { |
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
| import { Toolbar, ToolbarButton, ToolbarGroup } from "@wordpress/components"; | |
| <ToolbarButton onClick={...}>Label</ToolbarButton> | |
| <ToolbarButton icon="icon" onClick={...}>Label</ToolbarButton> | |
| <ToolbarButton> | |
| {props => <DropdownMenu toggleProps={props} />} | |
| </ToolbarButton> | |
| <ToolbarButton as={DropdownMenu} /> |
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
| const Button = ({ as: T, ...props }) => <T {...props} />; | |
| Button.propTypes = { | |
| as: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) | |
| }; | |
| Button.defaultProps = { | |
| as: "button" | |
| }; |
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
| const callAll = (...fns) => (...args) => fns.forEach(fn => fn && fn(...args)); | |
| const internalOnLoad = () => console.log("loaded"); | |
| const Avatar = ({ className, style, onLoad, ...props }) => ( | |
| <img | |
| className={`avatar ${className}`} | |
| style={{ borderRadius: "50%", ...style }} | |
| onLoad={callAll(internalOnLoad, onLoad)} | |
| {...props} |
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
| const Avatar = ({ className, style, ...props }) => ( | |
| <img | |
| className={`avatar ${className}`} | |
| style={{ borderRadius: "50%", ...style }} | |
| {...props} | |
| /> | |
| ); | |
| Avatar.propTypes = { | |
| src: PropTypes.string.isRequired, |
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
| const Avatar = ({ className, ...props }) => ( | |
| <img className={`avatar ${className}`} {...props} /> | |
| ); | |
| Avatar.propTypes = { | |
| src: PropTypes.string.isRequired, | |
| alt: PropTypes.string.isRequired, | |
| className: PropTypes.string | |
| }; |
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
| const Avatar = props => <img className="avatar" {...props} />; | |
| Avatar.propTypes = { | |
| src: PropTypes.string.isRequired, | |
| alt: PropTypes.string.isRequired | |
| }; |