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/SelectMaxParentalRating.tsx

47 lines
1.1 KiB
TypeScript
Raw Normal View History

import React, { FunctionComponent } from 'react';
import globalize from '../../../scripts/globalize';
const createSelectElement = ({ className, label, option }) => ({
__html: `<select
class="${className}"
is="emby-select"
label="${label}"
>
<option value=''></option>
${option}
</select>`
});
2022-01-22 19:20:09 +03:00
type RatingsArr = {
Name: string;
Value: number;
}
type IProps = {
className?: string;
label?: string;
2022-01-22 19:20:09 +03:00
parentalRatings: RatingsArr[];
}
const SelectMaxParentalRating: FunctionComponent<IProps> = ({ className, label, parentalRatings }: IProps) => {
2022-01-22 19:20:09 +03:00
const renderOption = () => {
let content = '';
2022-01-22 19:20:09 +03:00
for (const rating of parentalRatings) {
content += `<option value='${rating.Value}'>${rating.Name}</option>`;
}
return content;
};
return (
<div
dangerouslySetInnerHTML={createSelectElement({
className: className,
label: globalize.translate(label),
2022-01-22 19:20:09 +03:00
option: renderOption()
})}
/>
);
};
export default SelectMaxParentalRating;