Skip to content

Commit

Permalink
Add documentation of arrow, offsetX, and offsetY props
Browse files Browse the repository at this point in the history
  • Loading branch information
szhsin committed Oct 11, 2020
1 parent 2ff369e commit c78cbc5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React-Menu

> React menu components
> A customisable, lightweight, and optimised React menu library with accessibility.
**[Live examples and documentation](https://szhsin.github.io/react-menu/)**

Expand Down Expand Up @@ -49,6 +49,8 @@ export default function Example() {
}
```

[More examples and documentation](https://szhsin.github.io/react-menu/)

## License

MIT Licensed. Copyright (c) 2020 Zheng Song.
37 changes: 28 additions & 9 deletions example/src/data/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ const keepMountedProp = {
</>
};

const menuChildrenProp = {
name: 'children',
type: 'node',
desc: <p>Can be <code>MenuDivider, MenuHeader, MenuItem, FocusableItem,
MenuRadioGroup, SubMenu</code> or any of their combinations.</p>
};

const onChangeProp = {
name: 'onChange',
type: 'function',
Expand Down Expand Up @@ -131,9 +124,35 @@ const styleProps = (target, modifiers, className, styles) => [
}
];

const commonMenuProps = [
{
name: 'arrow',
type: 'boolean',
desc: <p>Set <code>true</code> to display an arrow pointing to its anchor element.</p>
},
{
name: 'offsetX',
type: 'number',
defaultVal: 0,
desc: <p>Set the horizontal distance (in pixels) between menu and its anchor element. The value can be negative.</p>
},
{
name: 'offsetY',
type: 'number',
defaultVal: 0,
desc: <p>Set the vertical distance (in pixels) between menu and its anchor element. The value can be negative.</p>
},
{
name: 'children',
type: 'node',
desc: <p>Can be <code>MenuDivider, MenuHeader, MenuItem, FocusableItem,
MenuRadioGroup, SubMenu</code> or any of their combinations.</p>
}
];

const menuPropsBase = [
...styleProps('menu', menuModifiers),
menuChildrenProp,
...commonMenuProps,
{
name: 'id',
type: 'string | number',
Expand Down Expand Up @@ -333,8 +352,8 @@ const submenu = {
rows: [
...styleProps('submenu item', submenuModifiers),
...styleProps('submenu', menuModifiers, 'menuClassName', 'menuStyles'),
...commonMenuProps,
keepMountedProp,
menuChildrenProp,
onChangeProp,
{
name: 'aria-label',
Expand Down

0 comments on commit c78cbc5

Please sign in to comment.