mirror of
https://github.com/kusti8/proton-native.git
synced 2026-05-15 14:15:50 -06:00
Add types constants. (#50)
* Add types constants. Remove extra space in documentation * remove unnecesary file
This commit is contained in:
parent
25a027d26e
commit
7741dd2fcc
4 changed files with 39 additions and 16 deletions
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
## Install
|
||||
|
||||
### Automatic
|
||||
### Automatic
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
# install the cli app
|
||||
npm install -g create-proton-app
|
||||
# create your project
|
||||
|
|
@ -24,4 +24,4 @@ You can alternatively use `npx` if you prefer.
|
|||
|
||||
### Manual
|
||||
|
||||
The old manual instructions are still available [here](manual_install.md)
|
||||
The old manual instructions are still available [here](manual_install.md)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,17 @@ import {
|
|||
MenuBar,
|
||||
} from './';
|
||||
import { Menu } from '../';
|
||||
import {
|
||||
ITEM,
|
||||
CHECK,
|
||||
QUIT,
|
||||
PREFERENCES,
|
||||
ABOUT,
|
||||
SEPARATOR
|
||||
} from '../constants/types';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
|
||||
const functionMappings = {
|
||||
onChange: 'onChanged',
|
||||
onClose: 'onClosing',
|
||||
|
|
@ -103,17 +112,17 @@ class DesktopComponent {
|
|||
// we assume we are a ComboBox.Item, and just append the child
|
||||
parent.element.append(this.props.children);
|
||||
} else if (parent instanceof MenuBar) {
|
||||
if (this.props.type === 'Item') {
|
||||
if (this.props.type === ITEM) {
|
||||
this.element = parent.element.appendItem(this.props.children);
|
||||
} else if (this.props.type === 'Check') {
|
||||
} else if (this.props.type === CHECK) {
|
||||
this.element = parent.element.appendCheckItem(this.props.children);
|
||||
} else if (this.props.type === 'Quit') {
|
||||
} else if (this.props.type === QUIT) {
|
||||
this.element = parent.element.appendQuitItem();
|
||||
} else if (this.props.type === 'Preferences') {
|
||||
} else if (this.props.type === PREFERENCES) {
|
||||
this.element = parent.element.appendPreferencesItem();
|
||||
} else if (this.props.type === 'About') {
|
||||
} else if (this.props.type === ABOUT) {
|
||||
this.element = parent.element.appendAboutItem();
|
||||
} else if (this.props.type === 'Separator') {
|
||||
} else if (this.props.type === SEPARATOR) {
|
||||
parent.element.appendSeparator();
|
||||
}
|
||||
} else if (this instanceof Menu) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,14 @@ import DesktopComponent, {
|
|||
universalPropTypes,
|
||||
universalDefaultProps,
|
||||
} from './DesktopComponent';
|
||||
import {
|
||||
ITEM,
|
||||
CHECK,
|
||||
QUIT,
|
||||
PREFERENCES,
|
||||
ABOUT,
|
||||
SEPARATOR
|
||||
} from '../constants/types';
|
||||
import libui from 'libui-node';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
|
|
@ -57,12 +65,12 @@ MenuBar.Item.PropTypes = {
|
|||
children: PropTypes.string,
|
||||
checked: PropTypes.bool,
|
||||
type: PropTypes.oneOf([
|
||||
'Check',
|
||||
'Quit',
|
||||
'About',
|
||||
'Preferences',
|
||||
'Separator',
|
||||
'Item',
|
||||
CHECK,
|
||||
QUIT,
|
||||
ABOUT,
|
||||
PREFERENCES,
|
||||
SEPARATOR,
|
||||
ITEM,
|
||||
]),
|
||||
onClick: PropTypes.func,
|
||||
...universalPropTypes,
|
||||
|
|
@ -71,7 +79,7 @@ MenuBar.Item.PropTypes = {
|
|||
MenuBar.Item.defaultProps = {
|
||||
children: '',
|
||||
checked: false,
|
||||
type: 'Item',
|
||||
type: ITEM,
|
||||
onClick: () => {},
|
||||
...universalDefaultProps,
|
||||
};
|
||||
|
|
|
|||
6
src/constants/types.js
Normal file
6
src/constants/types.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export const ITEM = 'Item';
|
||||
export const CHECK = 'Check';
|
||||
export const QUIT = 'Quit';
|
||||
export const PREFERENCES = 'Preferences';
|
||||
export const ABOUT = 'About';
|
||||
export const SEPARATOR = 'Separator';
|
||||
Loading…
Add table
Add a link
Reference in a new issue