Migrate ./components/channel_header_mobile/show_search_button/show_search_button.tsx from Class component to functional component (#25636)
* chore: migrate show_search_button.tsx to functional component * chore: styled show_search_button to match the pattern * test: updated snapshots
Этот коммит содержится в:
@@ -42,7 +42,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
|
||||
}
|
||||
}
|
||||
/>
|
||||
<Connect(ShowSearchButton) />
|
||||
<Connect(Component) />
|
||||
<Connect(injectIntl(MobileChannelHeaderPlug))
|
||||
channel={
|
||||
Object {
|
||||
@@ -113,7 +113,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
|
||||
}
|
||||
}
|
||||
/>
|
||||
<Connect(ShowSearchButton) />
|
||||
<Connect(Component) />
|
||||
<Connect(injectIntl(MobileChannelHeaderPlug))
|
||||
channel={
|
||||
Object {
|
||||
@@ -184,7 +184,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
|
||||
}
|
||||
}
|
||||
/>
|
||||
<Connect(ShowSearchButton) />
|
||||
<Connect(Component) />
|
||||
<Connect(injectIntl(MobileChannelHeaderPlug))
|
||||
channel={
|
||||
Object {
|
||||
@@ -255,7 +255,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
|
||||
}
|
||||
}
|
||||
/>
|
||||
<Connect(ShowSearchButton) />
|
||||
<Connect(Component) />
|
||||
<Connect(injectIntl(MobileChannelHeaderPlug))
|
||||
channel={
|
||||
Object {
|
||||
|
||||
@@ -15,24 +15,23 @@ type Props = {
|
||||
actions: Actions;
|
||||
}
|
||||
|
||||
export default class ShowSearchButton extends React.PureComponent<Props> {
|
||||
handleClick = () => {
|
||||
this.props.actions.openRHSSearch();
|
||||
const ShowSearchButton = ({actions}: Props) => {
|
||||
const handleClick = () => {
|
||||
actions.openRHSSearch();
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<button
|
||||
type='button'
|
||||
className='navbar-toggle navbar-right__icon navbar-search pull-right'
|
||||
onClick={this.handleClick}
|
||||
aria-label={localizeMessage('accessibility.button.Search', 'Search')}
|
||||
>
|
||||
<SearchIcon
|
||||
className='icon icon__search'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<button
|
||||
type='button'
|
||||
className='navbar-toggle navbar-right__icon navbar-search pull-right'
|
||||
onClick={handleClick}
|
||||
aria-label={localizeMessage('accessibility.button.Search', 'Search')}
|
||||
>
|
||||
<SearchIcon
|
||||
className='icon icon__search'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
export default React.memo(ShowSearchButton);
|
||||
|
||||
Ссылка в новой задаче
Block a user