mirror of
https://github.com/owncast/owncast.git
synced 2024-12-27 03:28:30 +03:00
28 lines
782 B
TypeScript
28 lines
782 B
TypeScript
|
/* eslint-disable react/no-danger */
|
||
|
import { FC } from 'react';
|
||
|
import { useRecoilValue } from 'recoil';
|
||
|
import { ClientConfig } from '../../interfaces/client-config.model';
|
||
|
import { clientConfigStateAtom } from '../stores/ClientConfigStore';
|
||
|
|
||
|
export const Theme: FC = () => {
|
||
|
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
||
|
const { appearanceVariables, customStyles } = clientConfig;
|
||
|
|
||
|
const appearanceVars = Object.keys(appearanceVariables)
|
||
|
.filter(variable => !!appearanceVariables[variable])
|
||
|
.map(variable => `--${variable}: ${appearanceVariables[variable]}`);
|
||
|
|
||
|
return (
|
||
|
<style
|
||
|
dangerouslySetInnerHTML={{
|
||
|
__html: `
|
||
|
:root {
|
||
|
${appearanceVars.join(';\n')}
|
||
|
}
|
||
|
${customStyles}
|
||
|
`,
|
||
|
}}
|
||
|
/>
|
||
|
);
|
||
|
};
|