Skip to content

Commit

Permalink
feat: new theme option: nestingSpacing
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed May 28, 2018
1 parent 6b1e8e7 commit 782ef77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/common-elements/fields-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@ export const PropertyBullet = styled.span`
`;

export const InnerPropertiesWrap = styled.div`
padding: 1em;
padding: ${({ theme }) => theme.schemaView.nestingSpacing};
`;

export const PropertiesTable = styled.table`
border-collapse: collapse;
border-radius: 3px;
font-size: ${props => props.theme.baseFont.size};
border-spacing: 0;
width: 100%;
Expand All @@ -140,7 +141,8 @@ export const PropertiesTable = styled.table`
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap} {
margin: 1em 0 1em 1em;
margin: ${({ theme }) => theme.schemaView.nestingSpacing};
margin-right: 0;
background: #f0f0f0;
}
Expand Down
4 changes: 3 additions & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const defaultTheme: ThemeInterface = {
typeNameColor: theme => transparentize(0.2, theme.colors.text),
typeTitleColor: theme => theme.schemaView.typeNameColor,
requireLabelColor: theme => theme.colors.error,
nestingSpacing: '1em',
},
baseFont: {
size: '14px',
Expand Down Expand Up @@ -135,6 +136,7 @@ export interface ResolvedThemeInterface {
typeNameColor: string;
typeTitleColor: string;
requireLabelColor: string;
nestingSpacing: string;
};
baseFont: {
size: string;
Expand Down Expand Up @@ -174,5 +176,5 @@ export type primitive = string | number | boolean | undefined | null;
export type AdvancedThemeDeep<T> = T extends primitive
? T | ((theme: ResolvedThemeInterface) => T)
: AdvancedThemeObject<T>;
export type AdvancedThemeObject<T> = { [P in keyof T]: AdvancedThemeDeep<T[P]> };
export type AdvancedThemeObject<T> = { [P in keyof T]?: AdvancedThemeDeep<T[P]> };
export type ThemeInterface = AdvancedThemeObject<ResolvedThemeInterface>;

0 comments on commit 782ef77

Please sign in to comment.