mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Use interface over type
This commit is contained in:
parent
9d88af3dfe
commit
de4a359c98
21 changed files with 100 additions and 106 deletions
|
@ -1,24 +1,21 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
const createElement = ({ id, className }: IProps) => ({
|
||||
const createElement = ({ className }: IProps) => ({
|
||||
__html: `<div
|
||||
is="emby-itemscontainer"
|
||||
${id}
|
||||
class="${className}"
|
||||
>
|
||||
</div>`
|
||||
});
|
||||
|
||||
type IProps = {
|
||||
id?: string;
|
||||
interface IProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const ItemsContainerElement: FunctionComponent<IProps> = ({ id, className }: IProps) => {
|
||||
const ItemsContainerElement: FC<IProps> = ({ className }) => {
|
||||
return (
|
||||
<div
|
||||
dangerouslySetInnerHTML={createElement({
|
||||
id: id ? `id='${id}'` : '',
|
||||
className: className
|
||||
})}
|
||||
/>
|
||||
|
|
|
@ -1,31 +1,29 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
const createScroller = ({ scrollerclassName, dataHorizontal, dataMousewheel, dataCenterfocus, id, className }: IProps) => ({
|
||||
const createScroller = ({ scrollerclassName, dataHorizontal, dataMousewheel, dataCenterfocus, className }: IProps) => ({
|
||||
__html: `<div is="emby-scroller"
|
||||
class="${scrollerclassName}"
|
||||
${dataHorizontal}
|
||||
${dataMousewheel}
|
||||
${dataCenterfocus}
|
||||
>
|
||||
<div
|
||||
is="emby-itemscontainer"
|
||||
${id}
|
||||
class="${className}"
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
is="emby-itemscontainer"
|
||||
class="${className}"
|
||||
>
|
||||
</div>
|
||||
</div>`
|
||||
});
|
||||
|
||||
type IProps = {
|
||||
interface IProps {
|
||||
scrollerclassName?: string;
|
||||
dataHorizontal?: string;
|
||||
dataMousewheel?: string;
|
||||
dataCenterfocus?: string;
|
||||
id?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const ItemsScrollerContainerElement: FunctionComponent<IProps> = ({ scrollerclassName, dataHorizontal, dataMousewheel, dataCenterfocus, id, className }: IProps) => {
|
||||
const ItemsScrollerContainerElement: FC<IProps> = ({ scrollerclassName, dataHorizontal, dataMousewheel, dataCenterfocus, className }) => {
|
||||
return (
|
||||
<div
|
||||
dangerouslySetInnerHTML={createScroller({
|
||||
|
@ -33,7 +31,6 @@ const ItemsScrollerContainerElement: FunctionComponent<IProps> = ({ scrollerclas
|
|||
dataHorizontal: dataHorizontal ? `data-horizontal="${dataHorizontal}"` : '',
|
||||
dataMousewheel: dataMousewheel ? `data-mousewheel="${dataMousewheel}"` : '',
|
||||
dataCenterfocus: dataCenterfocus ? `data-centerfocus="${dataCenterfocus}"` : '',
|
||||
id: id ? `id='${id}'` : '',
|
||||
className: className
|
||||
})}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue