mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
38 lines
948 B
TypeScript
38 lines
948 B
TypeScript
![]() |
import React, { FC, useEffect, useState } from 'react';
|
||
|
|
||
|
import { useApi } from 'hooks/useApi';
|
||
|
import { useUserSettings } from 'hooks/useUserSettings';
|
||
|
|
||
|
const CustomCss: FC = () => {
|
||
|
const { api } = useApi();
|
||
|
const { customCss: userCustomCss, disableCustomCss } = useUserSettings();
|
||
|
const [ brandingCssUrl, setBrandingCssUrl ] = useState<string>();
|
||
|
|
||
|
useEffect(() => {
|
||
|
if (!api) return;
|
||
|
|
||
|
setBrandingCssUrl(api.getUri('/Branding/Css.css'));
|
||
|
}, [ api ]);
|
||
|
|
||
|
if (!api) return null;
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
{!disableCustomCss && brandingCssUrl && (
|
||
|
<link
|
||
|
rel='stylesheet'
|
||
|
type='text/css'
|
||
|
href={brandingCssUrl}
|
||
|
/>
|
||
|
)}
|
||
|
{userCustomCss && (
|
||
|
<style>
|
||
|
{userCustomCss}
|
||
|
</style>
|
||
|
)}
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default CustomCss;
|