2022-11-13 07:26:55 +03:00
|
|
|
/* 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;
|
|
|
|
|
2023-05-07 00:10:13 +03:00
|
|
|
const appearanceVars = Object.keys(appearanceVariables || {})
|
2022-11-13 07:26:55 +03:00
|
|
|
.filter(variable => !!appearanceVariables[variable])
|
|
|
|
.map(variable => `--${variable}: ${appearanceVariables[variable]}`);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<style
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: `
|
|
|
|
:root {
|
|
|
|
${appearanceVars.join(';\n')}
|
|
|
|
}
|
|
|
|
${customStyles}
|
|
|
|
`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|