mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat: Quick New Dropdown.
This commit is contained in:
37
client/src/containers/QuickNewDropdown/QuickNewDropdown.js
Normal file
37
client/src/containers/QuickNewDropdown/QuickNewDropdown.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
import ListSelect from 'components/ListSelect';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { Icon } from 'components';
|
||||
import { Position } from '@blueprintjs/core';
|
||||
import quickNewOptions from 'common/quickNewOptions';
|
||||
|
||||
/**
|
||||
* Quick New Dropdown.
|
||||
*/
|
||||
function QuickNewDropdown() {
|
||||
const history = useHistory();
|
||||
|
||||
const handleClickQuickNew = ({ id }) => {
|
||||
history.push(`/${id}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<ListSelect
|
||||
items={quickNewOptions}
|
||||
onItemSelect={(type) => handleClickQuickNew(type)}
|
||||
textProp={'name'}
|
||||
filterable={false}
|
||||
popoverProps={{ minimal: false, position: Position.BOTTOM }}
|
||||
defaultText={'Select'}
|
||||
buttonProps={{
|
||||
text: <T id={'quick_new'} />,
|
||||
icon: <Icon icon={'plus-24'} iconSize={20} />,
|
||||
minimal: true,
|
||||
}}
|
||||
className={'form-group-quick-new-downDrop'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default QuickNewDropdown;
|
||||
Reference in New Issue
Block a user