redoc/lib/components/JsonSchema/_json-schema-common.scss
2017-02-02 23:13:41 +02:00

251 lines
4.4 KiB
SCSS

@import '../../shared/styles/variables';
$lines-width: 1px;
$bullet-size: 1px;
$cell-spacing: 25px;
$cell-padding: 10px;
$bullet-margin: 10px;
$line-border: $lines-width solid $tree-lines-color;
$line-border-erase: ($lines-width + 1px) solid $background-color;
$border-color: lighten($secondary-color, 50%);
$nullable-color: #3195a6;
$hint-border: 1px dotted rgba(38, 50, 56, 0.4);
$param-name-height: 20px;
$sub-schema-offset: ($bullet-size / 2) + $bullet-margin;
.param-name-wrap {
display: inline-block;
padding-right: $cell-spacing;
font-family: $headers-font, $headers-font-family;
}
.param-info {
border-bottom: 1px solid $border-color;
padding: $cell-padding 0;
width: 75%;
box-sizing: border-box;
> div {
line-height: 1;
}
}
.param-range {
position: relative;
top: 1px;
margin-right: 6px;
margin-left: 6px;
border-radius: $border-radius;
background-color: rgba($primary-color, 0.1);
padding: 0 4px;
color: rgba($primary-color, 0.7);
}
.param-description {
//font-size: 14px;
}
.param-required {
vertical-align: middle;
line-height: $param-name-height;
color: $red;
font-size: 12px;
font-weight: bold;
}
.param-nullable {
vertical-align: middle;
line-height: $param-name-height;
color: $nullable-color;
font-size: 12px;
font-weight: bold;
}
.param-type, .param-array-format {
vertical-align: middle;
line-height: $param-name-height;
color: rgba($black, 0.4);
font-size: 0.929em;
}
.param-type {
font-weight: normal;
word-break: break-all;
&.array::before, &.tuple::before {
color: $black;
font-weight: $base-font-weight;
.param-collection-format-multi + & {
content: none;
}
}
&.array::before {
content: $array-text;
}
&.tuple::before {
content: $tuple-text;
}
&.with-hint {
display: inline-block;
margin-bottom: 0.4em;
border-bottom: $hint-border;
padding: 0;
cursor: help;
}
&-trivial {
display: inline-block;
}
&-file {
font-weight: bold;
text-transform: capitalize;
}
}
// tree
// Bullet
.param-name {
border-left: $line-border;
box-sizing: border-box;
position: relative;
padding: $cell-padding 0;
vertical-align: top;
line-height: $param-name-height;
white-space: nowrap;
font-size: 0.929em;
font-weight: $regular;
> span::before {
content: '';
display: inline-block;
width: $bullet-size;
height: $bullet-size + 6;
background-color: $primary-color;
margin: 0 $bullet-margin;
vertical-align: middle;
}
> span::after {
content: '';
position: absolute;
border-top: $line-border;
width: $bullet-margin;
left: 0;
top: ($param-name-height / 2) + $cell-padding + 1;
}
}
.param:first-of-type {
> .param-name::before {
content: '';
display: block;
position: absolute;
left: -$lines-width;
top: 0;
border-left: $line-border-erase;
height: ($param-name-height / 2) + $cell-padding + 1;
}
}
.param:last-of-type,
.param.last {
> .param-name {
position: relative;
&::after {
content: '';
display: block;
position: absolute;
left: -$lines-width - 1px;
border-left: $line-border-erase;
top: ($param-name-height / 2) + $cell-padding + $lines-width + 1;
background-color: $background-color;
bottom: 0;
}
}
}
.param-wrap:last-of-type > .param-schema {
border-left-color: transparent;
}
.param-schema {
.param-wrap:first-of-type {
.param-name::before {
display: none;
}
}
}
.param-schema.last {
> td {
border-left: 0;
}
}
.param-enum {
color: $text-color;
font-size: 0.95em;
&::before {
content: 'Valid values: ';
}
}
.param-enum {
color: $text-color;
font-size: 0.95em;
&::before {
content: 'Valid values: ';
}
.param-type.array ~ &::before {
content: 'Valid items values: ';
}
}
.param-pattern {
color: $nullable-color;
white-space: nowrap;
&::before,
&::after {
content: '/';
margin: 0 3px;
font-size: 1.2em;
font-weight: bold;
}
}
.param-default {
font-size: 0.95em;
&::before {
content: 'Default: ';
}
}
.param-enum-value,
.param-default-value {
background-color: $background-color;
border: 1px solid rgba($secondary-color, 0.2);
margin: 2px 3px;
padding: 0 5px;
border-radius: 2px;
color: $secondary-color;
display: inline-block;
min-width: 20px;
text-align: center;
}