diff --git a/website/_includes/_mixins.jade b/website/_includes/_mixins.jade index 218609d02..f9960b71f 100644 --- a/website/_includes/_mixins.jade +++ b/website/_includes/_mixins.jade @@ -104,15 +104,31 @@ mixin button(url, trusted, ...style) language - [string] language for syntax highlighting (default: "python") supports basic relevant languages available for PrismJS -mixin code(label, language) - pre.c-code-block.o-block(class="lang-#{(language || DEFAULT_SYNTAX)}")&attributes(attributes) +mixin code(label, language, icon) + pre.c-code-block.o-block(class="lang-#{(language || DEFAULT_SYNTAX)}" class=icon ? "c-code-block--has-icon" : "")&attributes(attributes) if label h4.u-text-label.u-text-label--dark=label + if icon + - var classes = {'accept': 'u-color-green', 'reject': 'u-color-red'} + .c-code-block__icon(class=classes[icon] || "") + +icon(icon, 18) + code.c-code-block__content block +//- Code blocks to display old/new versions + +mixin code-old() + +code(false, false, "reject").o-block-small + block + +mixin code-new() + +code(false, false, "accept").o-block-small + block + + //- CodePen embed slug - [string] ID of CodePen demo (taken from URL) height - [integer] height of demo embed iframe diff --git a/website/assets/css/_components/_code.sass b/website/assets/css/_components/_code.sass index 06190021f..478f8a9e0 100644 --- a/website/assets/css/_components/_code.sass +++ b/website/assets/css/_components/_code.sass @@ -13,6 +13,17 @@ white-space: pre direction: ltr + &.c-code-block--has-icon + padding: 0 + display: flex + +.c-code-block__icon + padding: 0 0 0 1rem + display: flex + justify-content: center + align-items: center + border-left: 6px solid + //- Code block content diff --git a/website/assets/img/icons.svg b/website/assets/img/icons.svg index e970bb52c..3f226af93 100644 --- a/website/assets/img/icons.svg +++ b/website/assets/img/icons.svg @@ -30,5 +30,11 @@ + + + + + +