mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 02:55:41 +00:00
de7d4fbaa2
* Convert bootstrap to sass instead of checked in and less * Darken body, adjust header. * First pass at tab styles, each tab will need a lot of individual love tho. * Update footer to main site content, improve responsiveness. * Missing key added. * Fix dropdowns. * Convert GenerateWallet HTML over, still needs styling. * Send form. * Current rates styled. * CurrencySwap form styles. * SwapInfoHeader styled. * Finish up swap restyling, minor usability improvements for mobile. * Fix up notifications / alert customizations * Import v3 variables. * Fix notification spacing. * Align input height base with buttons. * Revert height base, add additional bootstrap overrides. * Grid overrides. * Move overrides to their own folder. Adjust naming. * Fix inconsistencies. * Style generate wallet pt 1. * Style generate wallet pt 2 * Style generate wallet pt 3 * Fix swap * Added some missing overries, fixed the fallout. * Remove header text, indicate alpha version. * Fix radio / checkbox weights. * Bind => arrow * Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown. * Fix token balances buttons, footr icons.
82 lines
1.7 KiB
JavaScript
82 lines
1.7 KiB
JavaScript
// @flow
|
|
import React, { Component } from 'react';
|
|
|
|
type Props<T> = {
|
|
value: T,
|
|
options: T[],
|
|
ariaLabel: string,
|
|
formatTitle: (option: T) => any,
|
|
extra?: any,
|
|
onChange: (value: T) => void
|
|
};
|
|
|
|
type State = {
|
|
expanded: boolean
|
|
};
|
|
|
|
export default class DropdownComponent<T: *> extends Component<
|
|
void,
|
|
Props<T>,
|
|
State
|
|
> {
|
|
props: Props<T>;
|
|
|
|
state = {
|
|
expanded: false
|
|
};
|
|
|
|
render() {
|
|
const { options, value, ariaLabel, extra } = this.props;
|
|
const { expanded } = this.state;
|
|
|
|
return (
|
|
<span className={`dropdown ${expanded ? 'open' : ''}`}>
|
|
<a
|
|
tabIndex="0"
|
|
aria-haspopup="true"
|
|
aria-expanded="false"
|
|
aria-label={ariaLabel}
|
|
className="dropdown-toggle"
|
|
onClick={this.toggleExpanded}
|
|
>
|
|
{this.formatTitle(value)}
|
|
<i className="caret" />
|
|
</a>
|
|
{expanded &&
|
|
<ul className="dropdown-menu">
|
|
{options.map((option, i) => {
|
|
return (
|
|
<li key={i}>
|
|
<a
|
|
className={option === value ? 'active' : ''}
|
|
onClick={this.onChange.bind(null, option)}
|
|
>
|
|
{this.formatTitle(option)}
|
|
</a>
|
|
</li>
|
|
);
|
|
})}
|
|
{extra}
|
|
</ul>}
|
|
</span>
|
|
);
|
|
}
|
|
|
|
formatTitle(option: any) {
|
|
return this.props.formatTitle(option);
|
|
}
|
|
|
|
toggleExpanded = () => {
|
|
this.setState(state => {
|
|
return {
|
|
expanded: !state.expanded
|
|
};
|
|
});
|
|
};
|
|
|
|
onChange = (value: any) => {
|
|
this.props.onChange(value);
|
|
this.setState({ expanded: false });
|
|
};
|
|
}
|