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
Этот коммит содержится в:
Aditi Patel
2023-12-12 04:17:25 -06:00
коммит произвёл GitHub
родитель e0b5b951f1
Коммит 07bf343e46
2 изменённых файлов: 22 добавлений и 23 удалений

Просмотреть файл

@@ -42,7 +42,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
} }
} }
/> />
<Connect(ShowSearchButton) /> <Connect(Component) />
<Connect(injectIntl(MobileChannelHeaderPlug)) <Connect(injectIntl(MobileChannelHeaderPlug))
channel={ channel={
Object { Object {
@@ -113,7 +113,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
} }
} }
/> />
<Connect(ShowSearchButton) /> <Connect(Component) />
<Connect(injectIntl(MobileChannelHeaderPlug)) <Connect(injectIntl(MobileChannelHeaderPlug))
channel={ channel={
Object { Object {
@@ -184,7 +184,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
} }
} }
/> />
<Connect(ShowSearchButton) /> <Connect(Component) />
<Connect(injectIntl(MobileChannelHeaderPlug)) <Connect(injectIntl(MobileChannelHeaderPlug))
channel={ channel={
Object { Object {
@@ -255,7 +255,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
} }
} }
/> />
<Connect(ShowSearchButton) /> <Connect(Component) />
<Connect(injectIntl(MobileChannelHeaderPlug)) <Connect(injectIntl(MobileChannelHeaderPlug))
channel={ channel={
Object { Object {

Просмотреть файл

@@ -15,17 +15,16 @@ type Props = {
actions: Actions; actions: Actions;
} }
export default class ShowSearchButton extends React.PureComponent<Props> { const ShowSearchButton = ({actions}: Props) => {
handleClick = () => { const handleClick = () => {
this.props.actions.openRHSSearch(); actions.openRHSSearch();
}; };
render() {
return ( return (
<button <button
type='button' type='button'
className='navbar-toggle navbar-right__icon navbar-search pull-right' className='navbar-toggle navbar-right__icon navbar-search pull-right'
onClick={this.handleClick} onClick={handleClick}
aria-label={localizeMessage('accessibility.button.Search', 'Search')} aria-label={localizeMessage('accessibility.button.Search', 'Search')}
> >
<SearchIcon <SearchIcon
@@ -34,5 +33,5 @@ export default class ShowSearchButton extends React.PureComponent<Props> {
/> />
</button> </button>
); );
} };
} export default React.memo(ShowSearchButton);