[Glitch] Fix media modal footer's “external link” not being a link

Port 255748dff4 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire
2022-02-25 01:20:41 +01:00
parent 8e04ba87b7
commit 4eed5019a2
3 changed files with 24 additions and 3 deletions

View File

@ -30,6 +30,7 @@ export default class IconButton extends React.PureComponent {
label: PropTypes.string,
counter: PropTypes.number,
obfuscateCount: PropTypes.bool,
href: PropTypes.string,
};
static defaultProps = {
@ -109,6 +110,7 @@ export default class IconButton extends React.PureComponent {
title,
counter,
obfuscateCount,
href,
} = this.props;
const {
@ -130,6 +132,21 @@ export default class IconButton extends React.PureComponent {
style.width = 'auto';
}
let contents = (
<React.Fragment>
<Icon id={icon} fixedWidth aria-hidden='true' /> {typeof counter !== 'undefined' && <span className='icon-button__counter'><AnimatedNumber value={counter} obfuscate={obfuscateCount} /></span>}
{this.props.label}
</React.Fragment>
);
if (href) {
contents = (
<a href={href} target='_blank' rel='noopener noreferrer'>
{contents}
</a>
);
}
return (
<button
aria-label={title}
@ -145,8 +162,7 @@ export default class IconButton extends React.PureComponent {
tabIndex={tabIndex}
disabled={disabled}
>
<Icon id={icon} fixedWidth aria-hidden='true' /> {typeof counter !== 'undefined' && <span className='icon-button__counter'><AnimatedNumber value={counter} obfuscate={obfuscateCount} /></span>}
{this.props.label}
{contents}
</button>
);
}