import styled, { extensionsHook, media, css } from '../styled-components'; import { deprecatedCss } from './mixins'; export const PropertiesTableCaption = styled.caption` text-align: right; font-size: 0.9em; font-weight: normal; color: ${props => props.theme.colors.text.secondary}; `; export const PropertyCell = styled.td<{ kind?: string }>` border-left: 1px dashed ${props => props.theme.schema.linesColor}; box-sizing: border-box; position: relative; padding: 10px; ${media.lessThan('small')` display: block; overflow: hidden; `} 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: repeating-linear-gradient( 0deg, ${props => props.theme.schema.linesColor}, ${props => props.theme.schema.linesColor} 3px, transparent 3px, transparent 5px, ${props => props.theme.schema.linesColor} 5px ); background-position: 0 10px; padding-top: 0; } tr.last > & { background-image: repeating-linear-gradient( 0deg, ${props => props.theme.schema.linesColor}, ${props => props.theme.schema.linesColor} 3px, transparent 3px, transparent 5px, ${props => props.theme.schema.linesColor} 5px ); background-size: 1px 22px; } tr.last + tr > & { border-left-color: transparent; } tr.last:first-child > & { background: none; border-left-color: transparent; } `; export const PropertyCellWithInner = styled(PropertyCell)` padding: 0; `; export const PropertyNameCell = styled(PropertyCell)` vertical-align: top; line-height: 20px; white-space: nowrap; font-size: 13px; font-family: ${props => props.theme.typography.code.fontFamily}; &.deprecated { ${deprecatedCss}; } ${({ kind }) => kind === 'patternProperties' && css` > span.property-name { display: inline-table; white-space: break-spaces; margin-right: 20px; ::before, ::after { content: '/'; filter: opacity(0.2); } } `} ${({ kind = '' }) => ['field', 'additionalProperties', 'patternProperties'].includes(kind) ? '' : 'font-style: italic'}; ${extensionsHook('PropertyNameCell')}; `; export const PropertyDetailsCell = styled.td` border-bottom: 1px solid rgb(228, 231, 235); padding: 10px 0; width: ${props => props.theme.schema.defaultDetailsWidth}; box-sizing: border-box; tr.expanded & { border-bottom: none; } ${media.lessThan('small')` padding: 0 20px; border-bottom: none; border-left: 1px dashed ${props => props.theme.schema.linesColor}; tr.last > & { border-left: none; } `} tr:first-of-type > & { padding-top: 0; } ${extensionsHook('PropertyDetailsCell')}; `; export const PropertyBullet = styled.span` color: ${props => props.theme.schema.linesColor}; font-family: ${props => props.theme.typography.code.fontFamily}; margin-right: 10px; &::before { content: ''; display: inline-block; vertical-align: middle; width: 10px; height: 1px; background: ${props => props.theme.schema.linesColor}; } &::after { content: ''; display: inline-block; vertical-align: middle; width: 1px; background: ${props => props.theme.schema.linesColor}; height: 7px; } `; export const InnerPropertiesWrap = styled.div` padding: ${({ theme }) => theme.schema.nestingSpacing}; `; export const PropertiesTable = styled.table` border-collapse: separate; border-radius: 3px; font-size: ${props => props.theme.typography.fontSize}; border-spacing: 0; width: 100%; > tr { vertical-align: middle; } ${media.lessThan('small')` display: block; > tr, > tbody > tr { display: block; padding-bottom:10px; } `} ${media.lessThan('small', false, ' and (-ms-high-contrast:none)')` td { float: left; width: 100%; } `} & ${InnerPropertiesWrap}, & ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap}, & ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} { margin: ${({ theme }) => theme.schema.nestingSpacing}; margin-right: 0; background: ${({ theme }) => theme.schema.nestedBackground}; } & ${InnerPropertiesWrap} ${InnerPropertiesWrap}, & ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap}, & ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} ${InnerPropertiesWrap} { background: #ffffff; } `;