Skip to content

Commit

Permalink
Fix buttons shifting when loading icon is visible (#1081)
Browse files Browse the repository at this point in the history
Loading button is now displayed in the search bar. This
fixes the issue where buttons shift whenever loading
icon is displayed

Signed-off-by: Neel Gondalia <ngondalia@blackberry.com>
  • Loading branch information
ngondalia authored Jun 11, 2024
1 parent 25e7308 commit 068b127
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,50 +137,57 @@ export class SearchFilterRenderer extends React.Component<SearchFilterRendererPr
</div>
)}
{this.state.hasClicked && (
<div>
<input
data-testid="search-filter-element-input"
type="text"
autoFocus={true}
onKeyDown={this.onKeyDownEvent}
onInput={this.onInputBoxChanged}
style={{
width: '50%',
margin: '10px',
color: this.state.isSearchSuccessful ? '' : 'red'
}}
defaultValue={this.props.filterModel.get(this.props.colName) ?? ''}
title="Enter a regular expression, then press Enter"
/>
{this.state.isSearching && (
<div className="search-bar-container">
<div className="input-container">
<input
data-testid="search-filter-element-input"
type="text"
autoFocus={true}
onKeyDown={this.onKeyDownEvent}
onInput={this.onInputBoxChanged}
style={{
width: '100%',
marginTop: '5px',
paddingRight: this.state.isSearching ? '14px' : '4px',
color: this.state.isSearchSuccessful ? '' : 'red'
}}
defaultValue={this.props.filterModel.get(this.props.colName) ?? ''}
title="Enter a regular expression, then press Enter"
/>
{this.state.isSearching && (
<div className="icon-container">
<FontAwesomeIcon
spin
icon={faSpinner}
title="Searching..."
style={{ fontSize: '10px' }}
/>
</div>
)}
</div>
<div className="toolbar-container">
<FontAwesomeIcon
className="hoverClass"
icon={faTimes}
style={{ marginLeft: '8px', marginTop: '5px' }}
onClick={this.onCloseClickHandler}
title="Clear search"
/>
<FontAwesomeIcon
className="hoverClass"
icon={faAngleDown}
style={{ marginLeft: '8px', marginTop: '5px' }}
onClick={this.onDownClickHandler}
title="Find next"
/>
<FontAwesomeIcon
spin
icon={faSpinner}
style={{ marginRight: '10px', marginTop: '20px' }}
title="Searching..."
className="hoverClass"
icon={faAngleUp}
style={{ marginLeft: '8px', marginTop: '5px' }}
onClick={this.onUpClickHandler}
title="Find previous"
/>
)}
<FontAwesomeIcon
className="hoverClass"
icon={faTimes}
style={{ marginTop: '20px' }}
onClick={this.onCloseClickHandler}
title="Clear search"
/>
<FontAwesomeIcon
className="hoverClass"
icon={faAngleDown}
style={{ marginLeft: '10px', marginTop: '20px' }}
onClick={this.onDownClickHandler}
title="Find next"
/>
<FontAwesomeIcon
className="hoverClass"
icon={faAngleUp}
style={{ marginLeft: '10px', marginTop: '20px' }}
onClick={this.onUpClickHandler}
title="Find previous"
/>
</div>
</div>
)}
</div>
Expand Down
27 changes: 27 additions & 0 deletions packages/react-components/style/output-components-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,30 @@ canvas {
outline: none;
box-shadow: none;
}

.search-bar-container {
display: flex;
align-items: center;
}

.input-container {
flex: 5;
padding: 5px;
display: flex;
position: relative;
}

.input-container input {
flex: 1;
}

.icon-container {
position: absolute;
right: 8px;
margin-top: 8px;
}

.toolbar-container {
flex: 1;
margin-right: 5px;
}

0 comments on commit 068b127

Please sign in to comment.