[MM-55122] Replaced the usage of LocalizedIcon in 'fa_warning_icon.tsx' with i/span tags (#25136)

Этот коммит содержится в:
Balaji K
2023-10-28 13:05:58 +05:30
коммит произвёл GitHub
родитель 3a1ff29fc8
Коммит 6a7adbe59c
2 изменённых файлов: 90 добавлений и 34 удалений

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

@@ -115,15 +115,45 @@ exports[`components/admin_console/request_button/request_button.jsx should match
<div <div
className="alert alert-warning" className="alert alert-warning"
> >
<injectIntl(WarningIcon)>
<WarningIcon <WarningIcon
additionalClassName={null} intl={
>
<LocalizedIcon
className="fa fa-warning"
title={
Object { Object {
"defaultMessage": "Warning Icon", "$t": [Function],
"id": "generic_icons.warning", "defaultFormats": Object {},
"defaultLocale": "en",
"defaultRichTextElements": undefined,
"fallbackOnEmptyString": true,
"formatDate": [Function],
"formatDateTimeRange": [Function],
"formatDateToParts": [Function],
"formatDisplayName": [Function],
"formatList": [Function],
"formatListToParts": [Function],
"formatMessage": [Function],
"formatNumber": [Function],
"formatNumberToParts": [Function],
"formatPlural": [Function],
"formatRelativeTime": [Function],
"formatTime": [Function],
"formatTimeToParts": [Function],
"formats": Object {},
"formatters": Object {
"getDateTimeFormat": [Function],
"getDisplayNames": [Function],
"getListFormat": [Function],
"getMessageFormat": [Function],
"getNumberFormat": [Function],
"getPluralRules": [Function],
"getRelativeTimeFormat": [Function],
},
"locale": "en",
"messages": Object {},
"onError": [Function],
"onWarn": [Function],
"textComponent": "span",
"timeZone": "Etc/UTC",
"wrapRichTextChunksInFragment": undefined,
} }
} }
> >
@@ -131,8 +161,8 @@ exports[`components/admin_console/request_button/request_button.jsx should match
className="fa fa-warning" className="fa fa-warning"
title="Warning Icon" title="Warning Icon"
/> />
</LocalizedIcon>
</WarningIcon> </WarningIcon>
</injectIntl(WarningIcon)>
<FormattedMessage <FormattedMessage
defaultMessage="Error Message: {error}" defaultMessage="Error Message: {error}"
id="error.message" id="error.message"
@@ -252,15 +282,45 @@ exports[`components/admin_console/request_button/request_button.jsx should match
<div <div
className="alert alert-warning" className="alert alert-warning"
> >
<injectIntl(WarningIcon)>
<WarningIcon <WarningIcon
additionalClassName={null} intl={
>
<LocalizedIcon
className="fa fa-warning"
title={
Object { Object {
"defaultMessage": "Warning Icon", "$t": [Function],
"id": "generic_icons.warning", "defaultFormats": Object {},
"defaultLocale": "en",
"defaultRichTextElements": undefined,
"fallbackOnEmptyString": true,
"formatDate": [Function],
"formatDateTimeRange": [Function],
"formatDateToParts": [Function],
"formatDisplayName": [Function],
"formatList": [Function],
"formatListToParts": [Function],
"formatMessage": [Function],
"formatNumber": [Function],
"formatNumberToParts": [Function],
"formatPlural": [Function],
"formatRelativeTime": [Function],
"formatTime": [Function],
"formatTimeToParts": [Function],
"formats": Object {},
"formatters": Object {
"getDateTimeFormat": [Function],
"getDisplayNames": [Function],
"getListFormat": [Function],
"getMessageFormat": [Function],
"getNumberFormat": [Function],
"getPluralRules": [Function],
"getRelativeTimeFormat": [Function],
},
"locale": "en",
"messages": Object {},
"onError": [Function],
"onWarn": [Function],
"textComponent": "span",
"timeZone": "Etc/UTC",
"wrapRichTextChunksInFragment": undefined,
} }
} }
> >
@@ -268,8 +328,8 @@ exports[`components/admin_console/request_button/request_button.jsx should match
className="fa fa-warning" className="fa fa-warning"
title="Warning Icon" title="Warning Icon"
/> />
</LocalizedIcon>
</WarningIcon> </WarningIcon>
</injectIntl(WarningIcon)>
<FormattedMessage <FormattedMessage
defaultMessage="Error Message: {error}" defaultMessage="Error Message: {error}"
id="error.message" id="error.message"

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

@@ -1,28 +1,24 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import classNames from 'classnames';
import React from 'react'; import React from 'react';
import {injectIntl, type IntlShape} from 'react-intl';
import LocalizedIcon from 'components/localized_icon';
import {t} from 'utils/i18n';
type Props = { type Props = {
additionalClassName: string | null; additionalClassName?: string;
intl: IntlShape;
} }
export default class WarningIcon extends React.PureComponent<Props> { class WarningIcon extends React.PureComponent<Props> {
public static defaultProps: Props = {
additionalClassName: null,
};
public render(): JSX.Element { public render(): JSX.Element {
const className = 'fa fa-warning' + (this.props.additionalClassName ? ' ' + this.props.additionalClassName : '');
return ( return (
<LocalizedIcon <i
className={className} className={classNames('fa fa-warning', this.props.additionalClassName)}
title={{id: t('generic_icons.warning'), defaultMessage: 'Warning Icon'}} title={this.props.intl.formatMessage({id: 'generic_icons.warning', defaultMessage: 'Warning Icon'})}
/> />
); );
} }
} }
export default injectIntl(WarningIcon);