Style dropdown to be width of input fields

pull/4145/head
Daniel Campbell 2018-08-08 17:31:36 -07:00
parent f81a310d5d
commit 8107804b1f
4 changed files with 32 additions and 13 deletions

View File

@ -7,6 +7,8 @@ import Authorized, {EDITOR_ROLE} from 'src/auth/Authorized'
import Button from 'src/reusable_ui/components/Button' import Button from 'src/reusable_ui/components/Button'
import {ToggleVisibility} from 'src/types/wizard' import {ToggleVisibility} from 'src/types/wizard'
import classnames from 'classnames'
import { import {
ComponentColor, ComponentColor,
ComponentSize, ComponentSize,
@ -39,7 +41,7 @@ class KapacitorDropdown extends PureComponent<Props & WithRouterProps> {
} }
public render() { public render() {
const {buttonSize} = this.props const {buttonSize, setActiveKapacitor, onAddNew} = this.props
if (this.isKapacitorsEmpty) { if (this.isKapacitorsEmpty) {
return ( return (
@ -62,7 +64,10 @@ class KapacitorDropdown extends PureComponent<Props & WithRouterProps> {
replaceWithIfNotAuthorized={this.UnauthorizedDropdown} replaceWithIfNotAuthorized={this.UnauthorizedDropdown}
> >
<Dropdown <Dropdown
className="dropdown-260" className={classnames({
'kapacitor-dropdown': onAddNew,
'dropdown-260': !onAddNew,
})}
buttonColor="btn-primary" buttonColor="btn-primary"
buttonSize={buttonSize} buttonSize={buttonSize}
items={this.kapacitorItems} items={this.kapacitorItems}

View File

@ -0,0 +1,11 @@
.kapacitor-step--dropdown {
padding: 0;
}
.kapacitor-dropdown {
min-width: 100%;
.dropdown,
.dropdown-toggle {
min-width: 100%;
}
}

View File

@ -193,17 +193,19 @@ class KapacitorStep extends PureComponent<Props, State> {
const storeSource = sources.filter(s => s.id === source.id)[0] const storeSource = sources.filter(s => s.id === source.id)[0]
return ( return (
<div className="form-group col-xs-12 wizard-input"> <div className="kapacitor-step--dropdown col-xs-12">
<KapacitorDropdown <div className="form-group col-xs-6">
suppressEdit={true} <KapacitorDropdown
source={storeSource} suppressEdit={true}
kapacitors={storeSource.kapacitors} source={storeSource}
deleteKapacitor={deleteKapacitor} kapacitors={storeSource.kapacitors}
setActiveKapacitor={this.handleSetActiveKapacitor} deleteKapacitor={deleteKapacitor}
buttonSize="btn-sm" setActiveKapacitor={this.handleSetActiveKapacitor}
onAddNew={this.resetDefault} buttonSize="btn-sm"
displayValue={!exists && newKapacitor.name} onAddNew={this.resetDefault}
/> displayValue={!exists && newKapacitor.name}
/>
</div>
</div> </div>
) )
} }

View File

@ -76,6 +76,7 @@
@import 'components/histogram-chart'; @import 'components/histogram-chart';
@import 'components/import-dashboard-mappings'; @import 'components/import-dashboard-mappings';
@import 'src/sources/components/ConnectionLink'; @import 'src/sources/components/ConnectionLink';
@import 'src/sources/components/KapacitorStep';
// Reusable UI Components // Reusable UI Components