Skip to content

Commit 782ef77

Browse files
committed
feat: new theme option: nestingSpacing
1 parent 6b1e8e7 commit 782ef77

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/common-elements/fields-layout.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ export const PropertyBullet = styled.span`
114114
`;
115115

116116
export const InnerPropertiesWrap = styled.div`
117-
padding: 1em;
117+
padding: ${({ theme }) => theme.schemaView.nestingSpacing};
118118
`;
119119

120120
export const PropertiesTable = styled.table`
121121
border-collapse: collapse;
122122
border-radius: 3px;
123+
font-size: ${props => props.theme.baseFont.size};
123124
124125
border-spacing: 0;
125126
width: 100%;
@@ -140,7 +141,8 @@ export const PropertiesTable = styled.table`
140141
${InnerPropertiesWrap}
141142
${InnerPropertiesWrap}
142143
${InnerPropertiesWrap} {
143-
margin: 1em 0 1em 1em;
144+
margin: ${({ theme }) => theme.schemaView.nestingSpacing};
145+
margin-right: 0;
144146
background: #f0f0f0;
145147
}
146148

src/theme.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const defaultTheme: ThemeInterface = {
3232
typeNameColor: theme => transparentize(0.2, theme.colors.text),
3333
typeTitleColor: theme => theme.schemaView.typeNameColor,
3434
requireLabelColor: theme => theme.colors.error,
35+
nestingSpacing: '1em',
3536
},
3637
baseFont: {
3738
size: '14px',
@@ -135,6 +136,7 @@ export interface ResolvedThemeInterface {
135136
typeNameColor: string;
136137
typeTitleColor: string;
137138
requireLabelColor: string;
139+
nestingSpacing: string;
138140
};
139141
baseFont: {
140142
size: string;
@@ -174,5 +176,5 @@ export type primitive = string | number | boolean | undefined | null;
174176
export type AdvancedThemeDeep<T> = T extends primitive
175177
? T | ((theme: ResolvedThemeInterface) => T)
176178
: AdvancedThemeObject<T>;
177-
export type AdvancedThemeObject<T> = { [P in keyof T]: AdvancedThemeDeep<T[P]> };
179+
export type AdvancedThemeObject<T> = { [P in keyof T]?: AdvancedThemeDeep<T[P]> };
178180
export type ThemeInterface = AdvancedThemeObject<ResolvedThemeInterface>;

0 commit comments

Comments
 (0)