mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Add option to import AsyncSelect
This commit is contained in:
parent
ef4bb665db
commit
203a66a904
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Select from 'react-select';
|
import ReactSelect from 'react-select';
|
||||||
import AsyncSelect from 'react-select/lib/Async';
|
import ReactAsyncSelect from 'react-select/lib/Async';
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
|
|
||||||
const styles = isSearchable => ({
|
const styles = isSearchable => ({
|
||||||
@ -58,21 +58,16 @@ const styles = isSearchable => ({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const SelectWrapper = props => (
|
const propTypes = {
|
||||||
<div>
|
|
||||||
{props.isAsync && <AsyncSelect styles={styles(props.isSearchable)} {...props} /> }
|
|
||||||
{!props.isAsync && <Select styles={styles(props.isSearchable)} {...props} />}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
SelectWrapper.propTypes = {
|
|
||||||
isAsync: PropTypes.bool,
|
isAsync: PropTypes.bool,
|
||||||
isSearchable: PropTypes.bool,
|
isSearchable: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
const Select = props => <ReactSelect styles={styles(props.isSearchable)} {...props} />;
|
||||||
|
const AsyncSelect = props => <ReactAsyncSelect styles={styles(props.isSearchable)} {...props} />;
|
||||||
|
Select.propTypes = propTypes;
|
||||||
|
AsyncSelect.propTypes = propTypes;
|
||||||
|
|
||||||
SelectWrapper.defaultProps = {
|
export {
|
||||||
isAsync: false,
|
Select,
|
||||||
isSearchable: false,
|
AsyncSelect,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SelectWrapper;
|
|
||||||
|
@ -5,7 +5,7 @@ import styled from 'styled-components';
|
|||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
|
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
|
||||||
import installers from 'constants/bridge';
|
import installers from 'constants/bridge';
|
||||||
import Select from 'components/Select';
|
import { Select } from 'components/Select';
|
||||||
import Link from 'components/Link';
|
import Link from 'components/Link';
|
||||||
import Button from 'components/Button';
|
import Button from 'components/Button';
|
||||||
import Loader from 'components/Loader';
|
import Loader from 'components/Loader';
|
||||||
|
Loading…
Reference in New Issue
Block a user