redoc/src/common-elements/fields-layout.ts

163 lines
3.6 KiB
TypeScript
Raw Normal View History

2018-07-19 13:05:53 +03:00
// import { transparentize } from 'polished';
2018-05-16 12:44:36 +03:00
import styled, { extensionsHook } from '../styled-components';
2018-01-22 21:30:53 +03:00
import { deprecatedCss } from './mixins';
2017-10-12 00:01:37 +03:00
export const PropertiesTableCaption = styled.caption`
text-align: right;
font-size: 0.9em;
font-weight: normal;
2018-07-19 13:05:53 +03:00
color: ${props => props.theme.colors.text.secondary};
2017-10-12 00:01:37 +03:00
`;
export const PropertyCell = styled.td<{ kind?: string }>`
2018-07-19 13:05:53 +03:00
border-left: 1px solid ${props => props.theme.schema.linesColor};
2017-10-12 00:01:37 +03:00
box-sizing: border-box;
position: relative;
padding: 10px 10px 10px 0;
tr:first-of-type > &,
tr.last > & {
border-left-width: 0;
background-position: top left;
background-repeat: no-repeat;
background-size: 1px 100%;
}
tr:first-of-type > & {
background-image: linear-gradient(
to bottom,
transparent 0%,
2018-03-20 12:17:59 +03:00
transparent 22px,
2018-07-19 13:05:53 +03:00
${props => props.theme.schema.linesColor} 22px,
${props => props.theme.schema.linesColor} 100%
2017-10-12 00:01:37 +03:00
);
}
tr.last > & {
background-image: linear-gradient(
to bottom,
2018-07-19 13:05:53 +03:00
${props => props.theme.schema.linesColor} 0%,
${props => props.theme.schema.linesColor} 22px,
2018-03-20 12:17:59 +03:00
transparent 22px,
2017-10-12 00:01:37 +03:00
transparent 100%
);
}
tr.last + tr > & {
border-left-color: transparent;
}
tr.last:first-child > & {
2017-10-12 00:01:37 +03:00
background: none;
border-left-color: transparent;
}
`;
export const PropertyCellWithInner = styled(PropertyCell)`
2017-10-12 00:01:37 +03:00
padding: 0;
`;
export const PropertyNameCell = styled(PropertyCell)`
2017-10-12 00:01:37 +03:00
vertical-align: top;
line-height: 20px;
white-space: nowrap;
font-size: 0.929em;
2018-07-19 13:05:53 +03:00
font-family: ${props => props.theme.typography.headings.fontFamily};
2017-10-12 00:01:37 +03:00
&.deprecated {
${deprecatedCss};
}
${({ kind }) => (kind !== 'field' ? 'font-style: italic' : '')};
2018-06-29 23:49:53 +03:00
${extensionsHook('PropertyNameCell')};
2017-10-12 00:01:37 +03:00
`;
export const PropertyDetailsCell = styled.td`
border-bottom: 1px solid #9fb4be;
padding: 10px 0;
2018-07-19 13:05:53 +03:00
width: ${props => props.theme.schema.defaultDetailsWidth};
2017-10-12 00:01:37 +03:00
box-sizing: border-box;
tr.expanded & {
border-bottom: none;
}
`;
export const PropertyBullet = styled.span`
2018-07-19 13:05:53 +03:00
color: ${props => props.theme.schema.linesColor};
font-family: ${props => props.theme.typography.code.fontFamily};
2017-10-12 00:01:37 +03:00
margin-right: 10px;
&::before {
content: '';
display: inline-block;
vertical-align: middle;
width: 10px;
height: 1px;
2018-07-19 13:05:53 +03:00
background: ${props => props.theme.schema.linesColor};
2017-10-12 00:01:37 +03:00
}
&::after {
content: '';
display: inline-block;
vertical-align: middle;
width: 1px;
2018-07-19 13:05:53 +03:00
background: ${props => props.theme.schema.linesColor};
2017-10-12 00:01:37 +03:00
height: 7px;
}
`;
export const InnerPropertiesWrap = styled.div`
2018-07-19 13:05:53 +03:00
padding: ${({ theme }) => theme.schema.nestingSpacing};
2017-10-12 00:01:37 +03:00
`;
export const PropertiesTable = styled.table`
border-collapse: separate;
2017-10-12 00:01:37 +03:00
border-radius: 3px;
2018-07-19 13:05:53 +03:00
font-size: ${props => props.theme.typography.fontSize};
2017-10-12 00:01:37 +03:00
border-spacing: 0;
width: 100%;
> tr {
vertical-align: middle;
}
&
${InnerPropertiesWrap},
&
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap},
&
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap} {
2018-07-19 13:05:53 +03:00
margin: ${({ theme }) => theme.schema.nestingSpacing};
2018-05-28 21:45:34 +03:00
margin-right: 0;
2018-07-19 13:05:53 +03:00
background: ${({ theme }) => theme.schema.nestedBackground};
2017-10-12 00:01:37 +03:00
}
&
${InnerPropertiesWrap}
${InnerPropertiesWrap},
&
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap},
&
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap}
${InnerPropertiesWrap} {
background: #ffffff;
}
`;