Further improvements to dropdown html

master
Surinna Curtis 8 years ago committed by Gô Shoemake
parent 85d5249479
commit dd49c10cdb
  1. 26
      app/javascript/mastodon/features/compose/components/advanced_options_dropdown.js

@ -1,6 +1,11 @@
import React from 'react'; import React from 'react';
import IconButton from '../../../components/icon_button'; import IconButton from '../../../components/icon_button';
const iconStyle = {
height: null,
lineHeight: '27px',
};
export default class AdvancedOptionsDropdown extends React.PureComponent { export default class AdvancedOptionsDropdown extends React.PureComponent {
onToggleDropdown = () => { onToggleDropdown = () => {
this.setState({ open: !this.state.open }); this.setState({ open: !this.state.open });
@ -32,18 +37,31 @@ export default class AdvancedOptionsDropdown extends React.PureComponent {
render () { render () {
const { open } = this.state; const { open } = this.state;
const dropdownItems = <div role='button' className='advanced-options-dropdown__option'>
<div className='advanced-options-dropdown__option__content'>test</div> const options = [
</div>; { icon: 'wifi', shortText: 'Local-only', longText: 'bla' },
];
const optionElems = options.map((option) => {
return <div role='button' className='advanced-options-dropdown__option'>
<div className='advanced-options-dropdown__option__icon'>
<IconButton icon={option.icon} />
</div>
<div className='advanced-options-dropdown__option__content'>
<strong>{option.shortText}</strong>
{option.longText}
</div>
</div>;
});
return <div ref={this.setRef} className={`advanced-options-dropdown ${open ? 'active' : ''}`}> return <div ref={this.setRef} className={`advanced-options-dropdown ${open ? 'active' : ''}`}>
<div className='advanced-options-dropdown__value'> <div className='advanced-options-dropdown__value'>
<IconButton className='advanced-options-dropdown__value' <IconButton className='advanced-options-dropdown__value'
icon='ellipsis-h' active={open} icon='ellipsis-h' active={open}
size={18} inverted size={18} inverted
style={iconStyle}
onClick={this.onToggleDropdown} /> onClick={this.onToggleDropdown} />
</div> </div>
<div className='advanced-options-dropdown__dropdown'> <div className='advanced-options-dropdown__dropdown'>
{open && dropdownItems} {optionElems}
</div> </div>
</div>; </div>;
} }

Loading…
Cancel
Save