1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

use LinkButton in SectionTitleContainer

This commit is contained in:
David Stensland 2024-02-24 12:27:37 -08:00 committed by Bill Thornton
parent 7011d09b4b
commit 30bce48c23
2 changed files with 8 additions and 40 deletions

View file

@ -1,6 +1,7 @@
import React, { FunctionComponent } from 'react'; import React, { FunctionComponent } from 'react';
import IconButtonElement from './IconButtonElement'; import IconButtonElement from './IconButtonElement';
import SectionTitleLinkElement from './SectionTitleLinkElement'; import LinkButton from './emby-button/LinkButton';
import globalize from '../scripts/globalize';
type IProps = { type IProps = {
SectionClassName?: string; SectionClassName?: string;
@ -28,11 +29,13 @@ const SectionTitleContainer: FunctionComponent<IProps> = ({ SectionClassName, ti
icon={btnIcon} icon={btnIcon}
/>} />}
{isLinkVisible && <SectionTitleLinkElement {isLinkVisible && <LinkButton
className='raised button-alt headerHelpButton' className='raised button-alt headerHelpButton'
title='Help' target='_blank'
url={url} rel='noopener noreferrer'
/>} href={url}>
{globalize.translate('Help')}
</LinkButton>}
</div> </div>
); );

View file

@ -1,35 +0,0 @@
import React, { FunctionComponent } from 'react';
import globalize from 'lib/globalize';
const createLinkElement = ({ className, title, href }: { className?: string, title?: string, href?: string }) => ({
__html: `<a
is="emby-linkbutton"
rel="noopener noreferrer"
class="${className}"
target="_blank"
href="${href}"
>
${title}
</a>`
});
type IProps = {
title?: string;
className?: string;
url?: string
};
const SectionTitleLinkElement: FunctionComponent<IProps> = ({ className, title, url }: IProps) => {
return (
<div
dangerouslySetInnerHTML={createLinkElement({
className: className,
title: globalize.translate(title),
href: url
})}
/>
);
};
export default SectionTitleLinkElement;