Refactor VerificationBadge
This commit is contained in:
parent
fdb298c417
commit
efe5670147
|
@ -1,10 +1,9 @@
|
|||
import classNames from 'classnames';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import React from 'react';
|
||||
import { useIntl, defineMessages } from 'react-intl';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import Icon from 'soapbox/components/ui/icon/icon';
|
||||
import { useSoapboxConfig } from 'soapbox/hooks';
|
||||
|
||||
const messages = defineMessages({
|
||||
verified: { id: 'account.verified', defaultMessage: 'Verified Account' },
|
||||
|
@ -14,12 +13,12 @@ interface IVerificationBadge {
|
|||
className?: string,
|
||||
}
|
||||
|
||||
const VerificationBadge = ({ className }: IVerificationBadge) => {
|
||||
const VerificationBadge: React.FC<IVerificationBadge> = ({ className }) => {
|
||||
const intl = useIntl();
|
||||
const soapboxConfig = useSoapboxConfig();
|
||||
|
||||
// Prefer a custom icon if found
|
||||
const customIcon = useSelector((state: ImmutableMap<string, any>) => state.getIn(['soapbox', 'verifiedIcon']));
|
||||
const icon = customIcon || require('icons/verified.svg');
|
||||
const icon = soapboxConfig.verifiedIcon || require('icons/verified.svg');
|
||||
|
||||
// Render component based on file extension
|
||||
const Element = icon.endsWith('.svg') ? Icon : 'img';
|
||||
|
|
Loading…
Reference in New Issue