@mdn/bob
Version:
Builder of Bits aka The MDN Web Docs interactive examples, example builder
309 lines (264 loc) • 5.77 kB
CSS
.example-choice-list {
padding: 0;
}
.editor-wrapper {
display: flex;
flex-direction: column;
}
@media screen and (min-width: 590px) {
.editor-wrapper {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 0;
}
}
.example-choice-list.live,
.example-choice-list.large.live {
padding: 1rem;
text-align: right;
overflow: auto;
border-bottom: 1px solid var(--border-primary);
}
@media screen and (min-width: 590px) {
.example-choice-list.live,
.example-choice-list.large.live {
padding: 1rem 2rem 1rem 1rem;
border: 0 none;
border-right: 1px solid var(--border-primary);
}
}
.example-choice-list.live {
height: 324px;
max-height: 324px;
}
.example-choice-list,
.example-choice-list.large {
float: none;
width: auto;
}
.output {
height: 300px;
overflow: hidden;
position: relative;
background-color: var(--background-primary);
overflow: hidden;
padding: 1em;
}
.output section {
height: 100%;
text-align: center;
}
.live .example-choice {
position: relative;
z-index: 1;
display: block;
padding: 0 12px;
margin: 0.2em 0;
width: 100%;
border: 1px solid var(--border-primary);
border-radius: var(--elem-radius);
cursor: pointer;
transition:
background-color 0.2s ease-out,
border 0.2s ease-out;
}
.live .example-choice {
background-color: var(--background-secondary);
}
.live .example-choice pre {
width: 100%;
}
.live .example-choice pre .cm-editor {
width: 100%;
height: auto;
text-align: left;
padding: 4px 0;
background: none;
border: none;
font-size: 0.875rem;
}
.live .example-choice .ͼ1.cm-editor.cm-focused {
outline: none;
}
.cm-editor .cm-line {
padding: 0;
}
.example-choice-list .example-choice:first-child {
margin-top: 0;
}
.example-choice:hover {
border-color: #666;
border-left-color: #666;
}
.example-choice:hover .copy {
display: block;
}
.live .example-choice:before,
.live .example-choice .example-choice-button {
transform: translateY(-50%);
position: absolute;
top: 50%;
opacity: 0;
transition: all 0.2s ease-out;
transform: translateY(-50%);
border-left: 4px solid var(--field-focus-border);
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
}
.live .example-choice:before {
content: "";
opacity: 0;
transition: all 0.2s ease-out;
transform: translateY(-50%);
position: absolute;
top: 50%;
right: -10px;
z-index: 1;
}
.live .example-choice .example-choice-button {
background-color: transparent;
border-left-color: #666;
outline-offset: 2px;
border-right: 0;
padding: 0;
right: -1em;
}
.live .example-choice .example-choice-button:focus {
opacity: 1;
}
@media screen and (min-width: 590px) {
.example-choice.selected:before,
.example-choice.invalid:before {
opacity: 1;
right: -1rem;
}
}
.example-choice.selected {
border-color: var(--field-focus-border);
box-shadow: var(--focus-01);
transition: height 0.5s;
cursor: text;
}
.example-choice.invalid:before {
right: -1.8em;
background: transparent url("../media/warning.svg") 0 0 no-repeat;
background-size: 20px;
border: none;
width: 20px;
height: 20px;
}
.example-choice.invalid {
border-color: #ffb800;
border-left-color: #ffb800;
}
.example-choice > code {
display: inline-block;
width: 90%;
}
.copy {
position: absolute;
top: 2px;
right: 2px;
background: var(--background-tertiary) 50% 50% no-repeat;
border-radius: var(--elem-radius);
padding: 6px 12px;
border: 1px solid var(--border-primary);
width: 30px;
height: 30px;
vertical-align: middle;
cursor: pointer;
display: none;
}
.copy:after {
-webkit-mask-image: url("../media/clippy.svg");
-webkit-mask-size: contain;
-webkit-mask-position: center;
mask-image: url("../media/clippy.svg");
mask-size: contain;
mask-position: center;
position: absolute;
width: 16px;
height: 16px;
top: 6px;
left: 6px;
background-color: var(--icon-primary);
content: "";
}
.copy:hover {
background-color: var(--button-secondary-hover);
}
.transition-all {
transition: all 0.3s ease-in;
}
[contenteditable]:focus {
outline: 0 solid transparent;
}
.example-choice.selected:focus {
outline: 0 solid transparent;
}
/* styling for small desktop viewports and below */
.small-desktop-and-below .example-choice-list,
.small-desktop-and-below .example-choice-list.live,
.small-desktop-and-below .example-choice-list.large.live,
.small-desktop-and-below .output {
float: none;
padding: 0;
width: 100%;
height: auto;
}
.small-desktop-and-below .example-choice-list.live {
max-height: 225px;
overflow: auto;
}
.small-desktop-and-below .output,
.small-desktop-and-below .output.large {
position: relative;
height: 225px;
}
.small-desktop-and-below .example-choice-list {
padding-right: 0.7em;
margin-bottom: 1em;
}
.small-desktop-and-below .example-choice:before {
content: none;
}
.small-desktop-and-below .live .example-choice {
min-height: 40px;
}
.small-desktop-and-below .copy {
display: none;
}
@supports (display: flex) {
.example-choice-list.live {
display: flex;
flex-direction: column;
}
.live .example-choice {
display: flex;
align-items: center;
flex-grow: 1;
}
.live .example-choice pre {
flex-grow: 1;
margin: 0;
}
.output section {
display: flex;
align-items: center;
justify-content: center;
}
.output section.flex-column {
flex-direction: column;
align-items: initial;
}
/* some examples does not work with a flex display on the container */
.output section.display-block {
display: block;
}
.output section img {
flex-grow: 0;
}
.output section.hidden {
display: none;
}
}