[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
className="alert alert-warning"
>
<WarningIcon
additionalClassName={null}
>
<LocalizedIcon
className="fa fa-warning"
title={
<injectIntl(WarningIcon)>
<WarningIcon
intl={
Object {
"defaultMessage": "Warning Icon",
"id": "generic_icons.warning",
"$t": [Function],
"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"
title="Warning Icon"
/>
</LocalizedIcon>
</WarningIcon>
</WarningIcon>
</injectIntl(WarningIcon)>
<FormattedMessage
defaultMessage="Error Message: {error}"
id="error.message"
@@ -252,15 +282,45 @@ exports[`components/admin_console/request_button/request_button.jsx should match
<div
className="alert alert-warning"
>
<WarningIcon
additionalClassName={null}
>
<LocalizedIcon
className="fa fa-warning"
title={
<injectIntl(WarningIcon)>
<WarningIcon
intl={
Object {
"defaultMessage": "Warning Icon",
"id": "generic_icons.warning",
"$t": [Function],
"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"
title="Warning Icon"
/>
</LocalizedIcon>
</WarningIcon>
</WarningIcon>
</injectIntl(WarningIcon)>
<FormattedMessage
defaultMessage="Error Message: {error}"
id="error.message"

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

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