Polish Search Widgets

pull/10616/head
Alex P 2018-02-27 22:48:05 -08:00
parent 315c7b9f0f
commit 6fb42a152c
8 changed files with 39 additions and 43 deletions

View File

@ -27,7 +27,7 @@ class FilterBar extends Component {
}) })
return ( return (
<div className="panel-heading"> <div className="panel-heading">
<div className="users__search-widget input-group admin__search-widget"> <div className="search-widget" style={{width: '300px'}}>
<input <input
type="text" type="text"
className="form-control input-sm" className="form-control input-sm"
@ -35,9 +35,7 @@ class FilterBar extends Component {
value={this.state.filterText} value={this.state.filterText}
onChange={this.handleText} onChange={this.handleText}
/> />
<div className="input-group-addon"> <span className="icon search" />
<span className="icon search" aria-hidden="true" />
</div>
</div> </div>
<button <button
className="btn btn-sm btn-primary" className="btn btn-sm btn-primary"

View File

@ -263,17 +263,15 @@ class SearchBar extends Component {
render() { render() {
return ( return (
<div className="users__search-widget input-group"> <div className="search-widget" style={{width: '260px'}}>
<input <input
type="text" type="text"
className="form-control" className="form-control input-sm"
placeholder="Filter Alerts..." placeholder="Filter Alerts..."
onChange={this.handleChange} onChange={this.handleChange}
value={this.state.searchTerm} value={this.state.searchTerm}
/> />
<div className="input-group-addon"> <span className="icon search" />
<span className="icon search" />
</div>
</div> </div>
) )
} }

View File

@ -50,7 +50,7 @@ class DashboardsPageContents extends Component {
<h2 className="panel-title"> <h2 className="panel-title">
{tableHeader} {tableHeader}
</h2> </h2>
<div className="u-flex u-ai-center dashboards-page--actions"> <div className="dashboards-page--actions">
<SearchBar <SearchBar
placeholder="Filter by Name..." placeholder="Filter by Name..."
onSearch={this.filterDashboards} onSearch={this.filterDashboards}

View File

@ -22,27 +22,30 @@ class SearchBar extends Component {
} }
render() { render() {
const {placeholder} = this.props const {placeholder, width} = this.props
return ( return (
<div className="users__search-widget input-group"> <div className="search-widget" style={{width: `${width}px`}}>
<input <input
type="text" type="text"
className="form-control" className="form-control input-sm"
placeholder={placeholder} placeholder={placeholder}
ref="searchInput" ref="searchInput"
onChange={this.handleChange} onChange={this.handleChange}
/> />
<div className="input-group-addon"> <span className="icon search" />
<span className="icon search" aria-hidden="true" />
</div>
</div> </div>
) )
} }
} }
const {func, string} = PropTypes const {func, number, string} = PropTypes
SearchBar.defaultProps = {
width: 260,
}
SearchBar.propTypes = { SearchBar.propTypes = {
width: number,
onSearch: func.isRequired, onSearch: func.isRequired,
placeholder: string.isRequired, placeholder: string.isRequired,
} }

View File

@ -105,8 +105,8 @@
display: flex; display: flex;
& > span { & > span {
font-size: 11px; font-size: 12px;
line-height: 28px; line-height: 30px;
order: 1; order: 1;
width: 20px; width: 20px;
margin-right: -20px; margin-right: -20px;

View File

@ -1,41 +1,37 @@
/* /*
Custom Search Widget Search Widget
---------------------------------------------- ----------------------------------------------------------------------------
*/ */
$search-widget-height: 36px;
.users__search-widget { .search-widget {
position: relative; position: relative;
&:first-child {
margin-right: 8px;
}
&:only-child {
margin-right: none;
}
input.form-control { input.form-control {
height: $search-widget-height;
position: relative; position: relative;
width: 100%;
z-index: 1; z-index: 1;
padding-left: 34px; padding-left: 34px;
border-radius: 4px !important;
&:focus + .input-group-addon { &:focus + .icon {
color: $c-pool; color: $c-pool;
} }
} }
.input-group-addon {
padding: 0; .icon {
text-align: center;
line-height: calc(#{$search-widget-height} - 2px);
position: absolute; position: absolute;
color: $g10-wolf; color: $g10-wolf;
top: 0; top: 50%;
left: 0; left: 20px;
height: 100%; transform: translate(-50%,-50%);
z-index: 4; z-index: 4;
border: 0;
width: 40px;
background-color: transparent;
transition: transition:
color 0.25s ease; color 0.25s ease;
} }
} }
.admin__search-widget {
width: 300px;
}

View File

@ -60,8 +60,9 @@ $dash-graph-options-arrow: 8px;
Dashboard Index Page Dashboard Index Page
------------------------------------------------------ ------------------------------------------------------
*/ */
.dashboards-page--actions .users__search-widget { .dashboards-page--actions {
margin-right: 8px; display: flex;
align-items: center;
} }
/* /*

View File

@ -9,7 +9,7 @@
border-radius: $radius; border-radius: $radius;
color: $g15-platinum; color: $g15-platinum;
background-color: $g2-kevlar; background-color: $g2-kevlar;
font-weight: 500; font-weight: 600;
box-shadow: none; box-shadow: none;
outline: none; outline: none;
transition: transition: