/* Interactive code blocks */ .code-preview { position: relative; border-radius: var(--wa-corners-1x); background-color: var(--wa-color-surface-lowered); margin-bottom: var(--wa-space-xl); } .code-preview__preview { position: relative; border: var(--wa-border-style) var(--wa-border-width-thin) var(--wa-color-surface-outline); border-bottom: none; border-top-left-radius: var(--wa-corners-1x); border-top-right-radius: var(--wa-corners-1x); background-color: var(--wa-color-surface-default); min-width: 20rem; max-width: 100%; padding: var(--wa-space-xl) var(--wa-space-3xl) var(--wa-space-xl) var(--wa-space-xl); } /* Block the preview while dragging to prevent iframes from intercepting drag events */ .code-preview__preview--dragging:after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; } .code-preview__resizer { display: flex; align-items: center; justify-content: center; position: absolute; top: 0; right: 0; bottom: 0; width: 1.75rem; font-size: 20px; color: var(--wa-color-text-quiet); background-color: var(--wa-color-surface-default); border-left: var(--wa-border-style) var(--wa-border-width-thin) var(--wa-color-surface-outline); border-top-right-radius: var(--wa-corners-1x); cursor: ew-resize; } @media screen and (max-width: 600px) { .code-preview__preview { padding-right: var(--wa-space-xl); } .code-preview__resizer { display: none; } } .code-preview__source { border: var(--wa-border-style) var(--wa-border-width-thin) var(--wa-color-surface-outline); border-bottom: none; border-radius: 0 !important; display: none; } .code-preview--expanded .code-preview__source { display: block; } .code-preview__source pre { margin: 0; } .code-preview__buttons { position: relative; border: var(--wa-border-style) var(--wa-border-width-thin) var(--wa-color-surface-outline); border-bottom-left-radius: var(--wa-corners-1x); border-bottom-right-radius: var(--wa-corners-1x); display: flex; } .code-preview__button { flex: 0 0 auto; height: 2.5rem; min-width: 2.5rem; border: none; border-radius: 0; background: var(--wa-color-surface-default); font: inherit; font-size: var(--wa-font-size-xs); font-weight: var(--wa-font-weight-normal); text-transform: uppercase; color: var(--wa-color-text-quiet); padding: 0 1rem; cursor: pointer; } .code-preview__button:not(:last-of-type) { border-right: var(--wa-border-style) var(--wa-border-width-thin) var(--wa-color-surface-outline); } .code-preview__button--html, .code-preview__button--react { width: 70px; display: flex; place-items: center; justify-content: center; } .code-preview__button--selected { font-weight: var(--wa-font-weight-heavy); color: var(--wa-color-brand-text-on-surface); } .code-preview__button--codepen { display: flex; place-items: center; width: 6rem; } .code-preview__button:first-of-type { border-bottom-left-radius: var(--wa-corners-1x); } .code-preview__button:last-of-type { border-bottom-right-radius: var(--wa-corners-1x); } .code-preview__button:hover, .code-preview__button:active { box-shadow: 0 0 0 var(--wa-border-width-thin) var(--wa-color-brand-container-outline-muted); border-right-color: transparent; background-color: var(--wa-color-brand-container-fill-muted); color: var(--wa-color-brand-text-on-surface); z-index: 1; } .code-preview__button:focus-visible { outline: none; outline: var(--wa-focus-ring); z-index: 2; } .code-preview__toggle { position: relative; display: flex; flex: 1 1 auto; align-items: center; justify-content: center; width: 100%; color: var(--wa-color-text-quiet); cursor: pointer; } .code-preview__toggle svg { width: 1em; height: 1em; margin-left: 0.25rem; } .code-preview--expanded .code-preview__toggle svg { transform: rotate(180deg); } /* We can apply data-flavor="html|react" to any element on the page to toggle it when the flavor changes */ .flavor-html [data-flavor]:not([data-flavor='html']) { display: none; } .flavor-react [data-flavor]:not([data-flavor='react']) { display: none; }