1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/components/dashboard/users/CheckBoxElement.tsx

37 lines
999 B
TypeScript
Raw Normal View History

2021-10-02 18:10:14 +03:00
import React, { FunctionComponent } from 'react';
2021-10-19 19:19:28 +03:00
import globalize from '../../../scripts/globalize';
2021-10-02 18:10:14 +03:00
2022-01-02 02:40:11 +03:00
const createCheckBoxElement = ({ labelClassName, type, className, title }) => ({
__html: `<label class="${labelClassName}">
2021-10-02 18:10:14 +03:00
<input
is="emby-checkbox"
type="${type}"
class="${className}"
/>
<span>${title}</span>
</label>`
});
type IProps = {
2022-01-02 02:40:11 +03:00
labelClassName?: string;
2021-10-02 18:10:14 +03:00
type?: string;
className?: string;
title?: string
}
2022-01-02 02:40:11 +03:00
const CheckBoxElement: FunctionComponent<IProps> = ({ labelClassName, type, className, title }: IProps) => {
2021-10-02 18:10:14 +03:00
return (
<div
2022-01-02 02:40:11 +03:00
className='sectioncheckbox'
2021-10-02 18:10:14 +03:00
dangerouslySetInnerHTML={createCheckBoxElement({
2022-01-02 02:40:11 +03:00
labelClassName: labelClassName ? labelClassName : '',
2021-10-02 18:10:14 +03:00
type: type,
className: className,
title: globalize.translate(title)
})}
/>
);
};
export default CheckBoxElement;