Fix code mixins

This commit is contained in:
ines 2017-11-06 20:16:19 +01:00
parent afc0450759
commit 71852d3f25

View File

@ -243,13 +243,12 @@ mixin code(label, language, prompt, height, icon, wrap)
pre.c-code-block.o-block(class="lang-#{(language || DEFAULT_SYNTAX)}" class=icon ? "c-code-block--has-icon" : null style=height ? "height: #{height}px" : null)&attributes(attributes)
if label
h4.u-text-label.u-text-label--dark=label
- var icon = icon || (prompt == 'accept' || prompt == 'reject')
if icon
- var classes = {'accept': 'u-color-green', 'reject': 'u-color-red'}
.c-code-block__icon(class=classes[icon] || null class=classes[icon] ? "c-code-block__icon--border" : null)
+icon(icon, 18)
code.c-code-block__content(class=wrap ? "u-wrap" : null data-prompt=icon ? null : prompt)
code.c-code-block__content(class=wrap ? "u-wrap" : null data-prompt=prompt)
block
@ -262,14 +261,14 @@ mixin code-wrapper()
//- Code blocks to display old/new versions
label - [string] ARIA label for block. Defaults to "correct"/"incorrect".
mixin code-old(label)
mixin code-old(label, lang, prompt)
- var label = label || 'incorrect'
+code(false, false, false, false, "reject").o-block-small(aria-label=label)
+code(false, lang, prompt, false, "reject").o-block-small(aria-label=label)
block
mixin code-new(label)
mixin code-new(label, lang, prompt)
- var label = label || 'correct'
+code(false, false, false, false, "accept").o-block-small(aria-label=label)
+code(false, lang, prompt, false, "accept").o-block-small(aria-label=label)
block