├── .gitignore
├── assets
└── sample.gif
├── .babelrc
├── demo
├── index.html
└── demo.js
├── src
├── components
│ ├── MenuItem.jsx
│ └── MenuSection.jsx
├── react-qsm.css
└── containers
│ └── QuickSelectMenu.jsx
├── webpack.config.js
├── package.json
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | public/bundle.js
3 | .vscode
--------------------------------------------------------------------------------
/assets/sample.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amorijs/react-qsm/HEAD/assets/sample.gif
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["env", "react"],
3 | "plugins": ["transform-class-properties", "transform-object-rest-spread"]
4 | }
5 |
--------------------------------------------------------------------------------
/demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | React Boilerplate
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/components/MenuItem.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | class MenuItem extends Component {
5 | static propTypes = { label: PropTypes.string.isRequired, className: PropTypes.string };
6 |
7 | render() {
8 | const { className, label, children, onClick } = this.props;
9 |
10 | return (
11 |
12 | {label}
13 | {children}
14 |
15 | );
16 | }
17 | }
18 |
19 | export default MenuItem;
20 |
--------------------------------------------------------------------------------
/demo/demo.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import ReactDOM from 'react-dom';
3 | import QuickSelectMenu from '../src/containers/QuickSelectMenu.jsx';
4 | import '../src/react-qsm.css';
5 |
6 | const sections = [
7 | {
8 | label: 'recently opened',
9 | items: [{ label: 'demo.js' }, { label: 'index.html' }]
10 | },
11 | {
12 | prefix: '>',
13 | label: 'recently used',
14 | items: [{ label: 'Preferences: Open User Settings' }, { label: 'Sync: Upload Settings' }]
15 | },
16 | {
17 | prefix: '>',
18 | label: 'other commands',
19 | items: [{ label: 'Add Cursor Above' }, { label: 'Add Cursor Below' }]
20 | },
21 | {
22 | prefix: '?',
23 | label: 'help',
24 | items: [{ label: '... Go to file' }, { label: '# Go to symbol in workspace' }]
25 | }
26 | ];
27 |
28 | const onMenuItemSelect = item => console.log(item);
29 |
30 | ReactDOM.render(
31 | ,
37 | document.getElementById('root')
38 | );
39 |
--------------------------------------------------------------------------------
/src/components/MenuSection.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import MenuItem from './MenuItem.jsx';
4 |
5 | class MenuSection extends Component {
6 | static propTypes = {
7 | name: PropTypes.string,
8 | items: PropTypes.arrayOf(PropTypes.object),
9 | activeIndex: PropTypes.number,
10 | menuSectionClassName: PropTypes.string,
11 | menuSectionLabelClassName: PropTypes.string,
12 | menuItemClassName: PropTypes.string
13 | };
14 |
15 | render() {
16 | const {
17 | items,
18 | activeIndex,
19 | label,
20 | handleItemClick,
21 | menuSectionClassName,
22 | menuSectionLabelClassName,
23 | menuItemClassName
24 | } = this.props;
25 |
26 | const menuItems = items.map((item, i) => (
27 |