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

apply suggestions

This commit is contained in:
grafixeyehero 2022-01-02 02:40:11 +03:00
parent 3c32e871ab
commit b22a9ed632
5 changed files with 88 additions and 92 deletions

View file

@ -1,8 +1,8 @@
import React, { FunctionComponent } from 'react';
import globalize from '../../../scripts/globalize';
const createCheckBoxElement = ({ type, className, title }) => ({
__html: `<label>
const createCheckBoxElement = ({ labelClassName, type, className, title }) => ({
__html: `<label class="${labelClassName}">
<input
is="emby-checkbox"
type="${type}"
@ -13,15 +13,18 @@ const createCheckBoxElement = ({ type, className, title }) => ({
});
type IProps = {
labelClassName?: string;
type?: string;
className?: string;
title?: string
}
const CheckBoxElement: FunctionComponent<IProps> = ({ type, className, title }: IProps) => {
const CheckBoxElement: FunctionComponent<IProps> = ({ labelClassName, type, className, title }: IProps) => {
return (
<div
className='sectioncheckbox'
dangerouslySetInnerHTML={createCheckBoxElement({
labelClassName: labelClassName ? labelClassName : '',
type: type,
className: className,
title: globalize.translate(title)

View file

@ -0,0 +1,52 @@
import React, { FunctionComponent } from 'react';
import globalize from '../../../scripts/globalize';
type IProps = {
activeTab: string;
}
const createLinkElement = ({ activeTab }) => ({
__html: `<a href="#"
is="emby-linkbutton"
data-role="button"
class="${activeTab === 'useredit' ? 'ui-btn-active' : ''}"
onclick="Dashboard.navigate('useredit.html', true);">
${globalize.translate('Profile')}
</a>
<a href="#"
is="emby-linkbutton"
data-role="button"
class="${activeTab === 'userlibraryaccess' ? 'ui-btn-active' : ''}"
onclick="Dashboard.navigate('userlibraryaccess.html', true);">
${globalize.translate('TabAccess')}
</a>
<a href="#"
is="emby-linkbutton"
data-role="button"
class="${activeTab === 'userparentalcontrol' ? 'ui-btn-active' : ''}"
onclick="Dashboard.navigate('userparentalcontrol.html', true);">
${globalize.translate('TabParentalControl')}
</a>
<a href="#"
is="emby-linkbutton"
data-role="button"
class="${activeTab === 'userpassword' ? 'ui-btn-active' : ''}"
onclick="Dashboard.navigate('userpassword.html', true);">
${globalize.translate('HeaderPassword')}
</a>`
});
const SectionTabs: FunctionComponent<IProps> = ({activeTab}: IProps) => {
return (
<div
data-role='controlgroup'
data-type='horizontal'
className='localnav'
dangerouslySetInnerHTML={createLinkElement({
activeTab: activeTab
})}
/>
);
};
export default SectionTabs;

View file

@ -1,36 +0,0 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable jsx-a11y/no-static-element-interactions */
import React, { FunctionComponent } from 'react';
import globalize from '../../../scripts/globalize';
type IProps = {
tabTitle?: string;
activeTab?: boolean;
onClick()
}
const createLinkElement = ({ className, tabTitle }) => ({
__html: `<a
href="#"
is="emby-linkbutton"
data-role="button"
class="${className}"
>
${tabTitle}
</a>`
});
const TabLinkElement: FunctionComponent<IProps> = ({ tabTitle, onClick, ...restactiveTab }: IProps) => {
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
<div
onClick={onClick}
dangerouslySetInnerHTML={createLinkElement({
className: restactiveTab.activeTab ? 'ui-btn-active' : '',
tabTitle: globalize.translate(tabTitle)
})}
/>
);
};
export default TabLinkElement;