jellyfish-web/src/components/dashboard/users/SectionTitleLinkElement.tsx

35 lines
872 B
TypeScript
Raw Normal View History

2021-10-02 16:46:46 +03:00
import React, { FunctionComponent } from 'react';
2021-10-07 21:08:21 +03:00
import globalize from '../../../scripts/globalize';
2021-10-02 16:46:46 +03:00
2022-02-18 14:27:39 +03:00
const createLinkElement = ({ className, title, href }: { className?: string, title?: string, href?: string }) => ({
2021-10-02 16:46:46 +03:00
__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;