feat: Extend Scheme

This commit is contained in:
Till Kolter 2020-08-23 13:10:03 +02:00
parent 02381504f5
commit 029b82b209

View File

@ -80,21 +80,21 @@ const defaultTheme: ThemeInterface = {
}, },
}, },
schema: { schema: {
linesColor: theme => linesColor: (theme) =>
lighten( lighten(
theme.colors.tonalOffset, theme.colors.tonalOffset,
desaturate(theme.colors.tonalOffset, theme.colors.primary.main), desaturate(theme.colors.tonalOffset, theme.colors.primary.main),
), ),
defaultDetailsWidth: '75%', defaultDetailsWidth: '75%',
typeNameColor: theme => theme.colors.text.secondary, typeNameColor: (theme) => theme.colors.text.secondary,
typeTitleColor: theme => theme.schema.typeNameColor, typeTitleColor: (theme) => theme.schema.typeNameColor,
requireLabelColor: theme => theme.colors.error.main, requireLabelColor: (theme) => theme.colors.error.main,
labelsTextSize: '0.9em', labelsTextSize: '0.9em',
nestingSpacing: '1em', nestingSpacing: '1em',
nestedBackground: '#fafafa', nestedBackground: '#fafafa',
arrow: { arrow: {
size: '1.1em', size: '1.1em',
color: theme => theme.colors.text.secondary, color: (theme) => theme.colors.text.secondary,
}, },
}, },
typography: { typography: {
@ -130,7 +130,7 @@ const defaultTheme: ThemeInterface = {
width: '260px', width: '260px',
backgroundColor: '#fafafa', backgroundColor: '#fafafa',
textColor: '#333333', textColor: '#333333',
activeTextColor: theme => activeTextColor: (theme) =>
theme.sidebar.textColor !== defaultTheme.sidebar!.textColor theme.sidebar.textColor !== defaultTheme.sidebar!.textColor
? theme.sidebar.textColor ? theme.sidebar.textColor
: theme.colors.primary.main, : theme.colors.primary.main,
@ -138,11 +138,19 @@ const defaultTheme: ThemeInterface = {
textTransform: 'uppercase', textTransform: 'uppercase',
}, },
level1Items: { level1Items: {
color: '#3C3C3C',
textTransform: 'none', textTransform: 'none',
fw: 600,
fontSize: '1rem'
},
level2Items: {
fw: 500,
color: '#3C3C3C',
fontSize: '.95rem'
}, },
arrow: { arrow: {
size: '1.5em', size: '1.5em',
color: theme => theme.sidebar.textColor, color: (theme) => theme.sidebar.textColor,
}, },
}, },
logo: { logo: {
@ -166,7 +174,7 @@ export function resolveTheme(theme: ThemeInterface): ResolvedThemeInterface {
const resolvedValues = {}; const resolvedValues = {};
let counter = 0; let counter = 0;
const setProxy = (obj, path: string) => { const setProxy = (obj, path: string) => {
Object.keys(obj).forEach(k => { Object.keys(obj).forEach((k) => {
const currentPath = (path ? path + '.' : '') + k; const currentPath = (path ? path + '.' : '') + k;
const val = obj[k]; const val = obj[k];
if (typeof val === 'function') { if (typeof val === 'function') {
@ -313,7 +321,16 @@ export interface ResolvedThemeInterface {
textTransform: string; textTransform: string;
}; };
level1Items: { level1Items: {
color: string;
fw: number;
textTransform: string; textTransform: string;
fontSize: string;
};
level2Items: {
color: string;
fw: number;
textTransform: string;
fontSize: string;
}; };
arrow: { arrow: {
size: string; size: string;