redoc/src/common-elements/schema.ts

68 lines
1.6 KiB
TypeScript
Raw Normal View History

import styled from '../styled-components';
import { darken } from 'polished';
import { deprecatedCss } from './mixins';
2017-10-12 00:01:37 +03:00
export const OneOfList = styled.div`
margin: 0 0 3px 0;
2017-10-12 00:01:37 +03:00
display: inline-block;
`;
export const OneOfLabel = styled.span`
font-size: 0.9em;
margin-right: 10px;
2018-07-19 13:05:53 +03:00
color: ${props => props.theme.colors.primary.main};
font-family: ${props => props.theme.typography.headings.fontFamily};
2017-10-12 00:01:37 +03:00
}
`;
export const OneOfButton = styled.button<{ active: boolean; deprecated: boolean }>`
2017-10-12 00:01:37 +03:00
display: inline-block;
margin-right: 10px;
margin-bottom: 5px;
2017-10-12 00:01:37 +03:00
font-size: 0.8em;
cursor: pointer;
2018-07-19 13:05:53 +03:00
border: 1px solid ${props => props.theme.colors.primary.main};
2017-10-12 00:01:37 +03:00
padding: 2px 10px;
line-height: 1.5em;
outline: none;
&:focus {
box-shadow: 0 0 0 1px ${props => props.theme.colors.primary.main};
}
2017-10-12 00:01:37 +03:00
${({ deprecated }) => (deprecated && deprecatedCss) || ''};
2017-10-12 00:01:37 +03:00
${props => {
if (props.active) {
return `
color: white;
2018-07-19 13:05:53 +03:00
background-color: ${props.theme.colors.primary.main};
&:focus {
box-shadow: none;
background-color: ${darken(0.15, props.theme.colors.primary.main)};
}
2017-10-12 00:01:37 +03:00
`;
} else {
return `
2018-07-19 13:05:53 +03:00
color: ${props.theme.colors.primary.main};
2017-10-12 00:01:37 +03:00
background-color: white;
`;
}
}}
`;
export const ArrayOpenningLabel = styled.div`
font-size: 0.9em;
2018-07-19 13:05:53 +03:00
font-family: ${props => props.theme.typography.code.fontFamily};
2017-10-12 00:01:37 +03:00
&::after {
content: ' [';
}
`;
export const ArrayClosingLabel = styled.div`
font-size: 0.9em;
2018-07-19 13:05:53 +03:00
font-family: ${props => props.theme.typography.code.fontFamily};
2017-10-12 00:01:37 +03:00
&::after {
content: ']';
}
`;