fix(code-snippet): set min/max height for multi-line code snippet #656

Fixes #656
This commit is contained in:
Eric Y Liu 2021-06-26 12:48:30 -07:00
commit 7fdab99812

View file

@ -97,6 +97,8 @@
}
$: expandText = expanded ? showLessText : showMoreText;
$: minHeight = expanded ? 16 * 15 : 48;
$: maxHeight = expanded ? "none" : 16 * 15 + "px";
$: if (type === "multi" && ref) {
if (code === undefined) setShowMoreLess();
if (code) tick().then(setShowMoreLess);
@ -178,6 +180,7 @@
tabindex="{type === 'single' && !disabled ? '0' : undefined}"
aria-label="{$$restProps['aria-label'] || copyLabel || 'code-snippet'}"
class:bx--snippet-container="{true}"
style="width: 100%; min-height: {minHeight}px; max-height: {maxHeight}"
>
<pre
bind:this="{ref}">