Skip to content

Commit

Permalink
[MM 62088] Browse channels modal: Clear 'x' button is misaligned and …
Browse files Browse the repository at this point in the history
…related ux improvements (mattermost#29729)
  • Loading branch information
M-ZubairAhmed authored Jan 5, 2025
1 parent 148dff2 commit 854d0e8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@

.input-clear {
top: 16px;
right: 46px;
right: 14px;
}

#searchIcon {
position: absolute;
z-index: 2;
top: 16px;
left: 46px;
left: 42px;
color: rgba(var(--center-channel-color-rgb), 0.64);
pointer-events: none;
}

#searchChannelsTextbox {
height: 48px;
padding-left: 40px;
border: 1px solid rgba(var(--center-channel-color-rgb), 0.16);
box-shadow: none;
font-size: 16px;
padding-inline: 40px;

&::placeholder {
color: var(--center-channel-color);
Expand Down Expand Up @@ -250,6 +250,7 @@
margin-top: 8px;
color: var(--center-channel-color);
line-height: 28px;
word-wrap: break-word;
}

.secondary-message {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ export default class BrowseChannels extends React.PureComponent<Props, State> {

return (
<GenericModal
onExited={this.handleExit}
id='browseChannelsModal'
aria-labelledby='browseChannelsModalLabel'
onExited={this.handleExit}
compassDesign={true}
modalHeaderText={title}
headerButton={createNewChannelButton('btn-secondary btn-sm')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.modal .StatusModal.GenericModal .StatusModal__clear-container.input-clear {
position: absolute;
top: 16px;
right: 20px;
right: 18px;
color: rgba(var(--center-channel-color-rgb), 0.64);
opacity: 1;
}
Expand Down
46 changes: 22 additions & 24 deletions webapp/channels/src/components/quick_input/quick_input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class QuickInput extends React.PureComponent<Props> {
delayInputUpdate: false,
value: '',
clearable: false,
tooltipPosition: 'bottom',
};

componentDidMount() {
Expand Down Expand Up @@ -133,7 +132,7 @@ export class QuickInput extends React.PureComponent<Props> {
this.input = input;
};

private onClear = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent) => {
private onClear = (e: React.MouseEvent<HTMLButtonElement> | React.TouchEvent) => {
e.preventDefault();
e.stopPropagation();

Expand Down Expand Up @@ -187,29 +186,28 @@ export class QuickInput extends React.PureComponent<Props> {
);

const showClearButton = this.props.onClear && (clearableWithoutValue || (clearable && value));
return (<div className='input-wrapper'>
{inputElement}
{showClearButton &&
<div
data-testid='input-clear'
className={classNames(clearClassName, 'input-clear visible')}
onMouseDown={this.onClear}
onTouchEnd={this.onClear}
role='button'
>
<WithTooltip
title={clearableTooltipText}
>
<span
className='input-clear-x'
aria-hidden='true'
>
<i className='icon icon-close-circle'/>
</span>
</WithTooltip>

return (
<div className='input-wrapper'>
{inputElement}
{showClearButton && (
<WithTooltip title={clearableTooltipText}>
<button
data-testid='input-clear'
className={classNames(clearClassName, 'input-clear visible')}
onClick={this.onClear}
>
<span
className='input-clear-x'
aria-hidden='true'
>
<i className='icon icon-close-circle'/>
</span>
</button>
</WithTooltip>
)}
</div>
}
</div>);
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ exports[`components/search_bar/SearchBar should match snapshot with search 1`] =
type="search"
value="test"
/>
<div
<button
class="input-clear visible"
data-testid="input-clear"
role="button"
>
<span
aria-hidden="true"
Expand All @@ -56,7 +55,7 @@ exports[`components/search_bar/SearchBar should match snapshot with search 1`] =
class="icon icon-close-circle"
/>
</span>
</div>
</button>
</div>
</div>
</form>
Expand Down Expand Up @@ -115,10 +114,9 @@ exports[`components/search_bar/SearchBar should match snapshot with search, with
type="search"
value="test"
/>
<div
<button
class="input-clear visible"
data-testid="input-clear"
role="button"
>
<span
aria-hidden="true"
Expand All @@ -128,7 +126,7 @@ exports[`components/search_bar/SearchBar should match snapshot with search, with
class="icon icon-close-circle"
/>
</span>
</div>
</button>
</div>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ exports[`component/user_group_popover should match snapshot 1`] = `
onChange={[Function]}
onClear={[Function]}
placeholder="Search members"
tooltipPosition="bottom"
type="text"
value=""
>
Expand Down
3 changes: 2 additions & 1 deletion webapp/channels/src/sass/components/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@
height: 100%;
align-items: center;
justify-content: center;
border: none;
margin: 0;
background: none;
color: rgba(var(--center-channel-color-rgb), 0.64);
cursor: pointer;
font-size: 16px;
visibility: hidden;

Expand Down

0 comments on commit 854d0e8

Please sign in to comment.