diff --git a/js/src/ui/Dropdown/dropdown.js b/js/src/ui/Dropdown/dropdown.js deleted file mode 100644 index 85808b7a5..000000000 --- a/js/src/ui/Dropdown/dropdown.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -/** USAGE: - Options = [ - { - text: 'Jenny Hess', - value: 'Jenny Hess', - image: { avatar: true, src: '/assets/images/avatar/small/jenny.jpg' }, - }, - ... - ] - - -**/ - -import React, { PropTypes } from 'react'; -import { Dropdown as SemanticDropdown } from 'semantic-ui-react'; - -import styles from './dropdown.css'; - -export default function Dropdown ({ defaultValue, disabled, fullWidth, fluid, hint, icon, name, onBlur, onChange, onClick, onClose, onFocus, options, placeholder, scrolling, search, selection, text, value }) { - return ( - - ); -} - -Dropdown.propTypes = { - defaultValue: PropTypes.number, // Initial value via index. - disabled: PropTypes.bool, // A disabled dropdown menu or item does not allow user interaction. - fullWidth: PropTypes.bool, // A dropdown can take the full width of its parent. - fluid: PropTypes.bool, // A dropdown can take the full width of its parent. - icon: PropTypes.any, // Shorthand for Icon. - name: PropTypes.func, // Name of the hidden input which holds the value. - onBlur: PropTypes.func, // Called on blur. - onChange: PropTypes.func, // Called when the user attempts to change the value. - onClick: PropTypes.func, // Called on click. - onClose: PropTypes.func, // Called on close. - onFocus: PropTypes.func, // Called on focus. - options: PropTypes.any, // Array of Dropdown.Item props e.g. `{ text: '', value: '' }` - hint: PropTypes.string, // Placeholder text. - placeholder: PropTypes.string, // Placeholder text. - scrolling: PropTypes.bool, // A dropdown can have its menu scroll. - search: PropTypes.bool, // A selection dropdown can allow a user to search through a large list of choices. - selection: PropTypes.any, // A dropdown can be used to select between choices in a form. - text: PropTypes.string, // The text displayed in the dropdown, usually for the active item. - value: PropTypes.any // Current value. Creates a controlled component. -}; - -Dropdown.defaultProps = { - disabled: false, - fluid: true, - search: true, - selection: true -}; diff --git a/js/src/ui/Dropdown/dropdown.css b/js/src/ui/Form/Dropdown/dropdown.css similarity index 100% rename from js/src/ui/Dropdown/dropdown.css rename to js/src/ui/Form/Dropdown/dropdown.css diff --git a/js/src/ui/Form/Dropdown/dropdown.js b/js/src/ui/Form/Dropdown/dropdown.js new file mode 100644 index 000000000..be3710bd7 --- /dev/null +++ b/js/src/ui/Form/Dropdown/dropdown.js @@ -0,0 +1,54 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { PropTypes } from 'react'; +import { Dropdown as SemanticDropdown } from 'semantic-ui-react'; + +import LabelComponent from '../labelComponent'; + +import styles from './dropdown.css'; + +// FIXME: Currently does not display the selected icon alongside +export default function Dropdown ({ className, disabled = false, fullWidth = true, hint, label, onChange, options, value }) { + return ( + + + + ); +} + +Dropdown.propTypes = { + className: PropTypes.string, + disabled: PropTypes.bool, // A disabled dropdown menu or item does not allow user interaction. + fullWidth: PropTypes.bool, // A dropdown can take the full width of its parent. + hint: PropTypes.string, // Placeholder text. + label: PropTypes.node, + name: PropTypes.func, // Name of the hidden input which holds the value. + onChange: PropTypes.func, // Called when the user attempts to change the value. + options: PropTypes.any, // Array of Dropdown.Item props e.g. `{ text: '', value: '' }` + value: PropTypes.any // Current value. Creates a controlled component. +}; diff --git a/js/src/ui/Dropdown/index.js b/js/src/ui/Form/Dropdown/index.js similarity index 100% rename from js/src/ui/Dropdown/index.js rename to js/src/ui/Form/Dropdown/index.js diff --git a/js/src/ui/Form/LabelComponent/index.js b/js/src/ui/Form/LabelComponent/index.js new file mode 100644 index 000000000..df586f3e8 --- /dev/null +++ b/js/src/ui/Form/LabelComponent/index.js @@ -0,0 +1,17 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './labelComponent'; diff --git a/js/src/ui/Form/LabelComponent/labelComponent.css b/js/src/ui/Form/LabelComponent/labelComponent.css new file mode 100644 index 000000000..b10a55213 --- /dev/null +++ b/js/src/ui/Form/LabelComponent/labelComponent.css @@ -0,0 +1,24 @@ +/* Copyright 2015-2017 Parity Technologies (UK) Ltd. +/* This file is part of Parity. +/* +/* Parity is free software: you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published by +/* the Free Software Foundation, either version 3 of the License, or +/* (at your option) any later version. +/* +/* Parity is distributed in the hope that it will be useful, +/* but WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with Parity. If not, see . +*/ + +.container { + .label { + color: rgba(0, 0, 0, 0.3); + pointer-events: none; + user-select: none; + } +} diff --git a/js/src/ui/Form/LabelComponent/labelComponent.js b/js/src/ui/Form/LabelComponent/labelComponent.js new file mode 100644 index 000000000..47dca7e80 --- /dev/null +++ b/js/src/ui/Form/LabelComponent/labelComponent.js @@ -0,0 +1,44 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { PropTypes } from 'react'; + +import styles from './labelComponent.css'; + +export default function LabelComponent ({ children, label }) { + return ( +
+ { + label + ? ( + + ) + : null + } + { children } +
+ ); +} + +LabelComponent.propTypes = { + label: PropTypes.node, + children: PropTypes.node.isRequired +}; diff --git a/js/src/ui/Form/form.css b/js/src/ui/Form/form.css index ff9ff9e84..16b4e0137 100644 --- a/js/src/ui/Form/form.css +++ b/js/src/ui/Form/form.css @@ -15,7 +15,6 @@ /* along with Parity. If not, see . */ .form { - margin-top: -1em; width: 100%; } diff --git a/js/src/ui/Form/index.js b/js/src/ui/Form/index.js index 32d824aab..0a6995104 100644 --- a/js/src/ui/Form/index.js +++ b/js/src/ui/Form/index.js @@ -17,6 +17,7 @@ export AddressSelect from './AddressSelect'; export Checkbox from './Checkbox'; export DappUrlInput from './DappUrlInput'; +export Dropdown from './Dropdown'; export FileSelect from './FileSelect'; export FormWrap from './FormWrap'; export Input from './Input'; diff --git a/js/src/ui/index.js b/js/src/ui/index.js index 0443c6c88..bd5f29bb7 100644 --- a/js/src/ui/index.js +++ b/js/src/ui/index.js @@ -31,10 +31,9 @@ export CurrencySymbol from './CurrencySymbol'; export DappCard from './DappCard'; export DappIcon from './DappIcon'; export DappLink from './DappLink'; -export Dropdown from './Dropdown'; export Errors from './Errors'; export Features, { FEATURES, FeaturesStore } from './Features'; -export Form, { AddressSelect, Checkbox, DappUrlInput, FileSelect, FormWrap, Input, InputAddress, InputAddressSelect, InputChip, InputDate, InputInline, InputTime, Label, RadioButtons, Select, TypedInput, VaultSelect } from './Form'; +export Form, { AddressSelect, Checkbox, DappUrlInput, Dropdown, FileSelect, FormWrap, Input, InputAddress, InputAddressSelect, InputChip, InputDate, InputInline, InputTime, Label, RadioButtons, Select, TypedInput, VaultSelect } from './Form'; export GasPriceEditor from './GasPriceEditor'; export GasPriceSelector from './GasPriceSelector'; export IconCache from './IconCache'; diff --git a/js/src/views/Account/Shapeshift/OptionsStep/optionsStep.js b/js/src/views/Account/Shapeshift/OptionsStep/optionsStep.js index fedbd7a7f..ef056acaf 100644 --- a/js/src/views/Account/Shapeshift/OptionsStep/optionsStep.js +++ b/js/src/views/Account/Shapeshift/OptionsStep/optionsStep.js @@ -33,16 +33,6 @@ const WARNING_LABELS = { ) }; -const FUND_ACCCOUNT_FROM = { - display: 'block', - paddingTop: '15px', - paddingBottom: '5px', - fontSize: '16px', - pointerEvents: 'none', - userSelect: 'none', - color: 'rgba(0, 0, 0, 0.298039)' -}; - @observer export default class OptionsStep extends Component { static propTypes = { @@ -69,17 +59,20 @@ export default class OptionsStep extends Component { return (
-
- -
+ } + label={ + + } options={ coins } onChange={ this.onSelectCoin } value={ coinSymbol } @@ -126,9 +119,9 @@ export default class OptionsStep extends Component { const { image, name, symbol } = coin; return { - image: image, - value: symbol, - text: name + image, + text: name, + value: symbol }; }