From 7fdab99812b5152276d4bfe5a1cb7aad17e5e56f Mon Sep 17 00:00:00 2001 From: Eric Y Liu Date: Sat, 26 Jun 2021 12:48:30 -0700 Subject: [PATCH] fix(code-snippet): set min/max height for multi-line code snippet #656 Fixes #656 --- src/CodeSnippet/CodeSnippet.svelte | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CodeSnippet/CodeSnippet.svelte b/src/CodeSnippet/CodeSnippet.svelte index b6c5fc55..994934ed 100644 --- a/src/CodeSnippet/CodeSnippet.svelte +++ b/src/CodeSnippet/CodeSnippet.svelte @@ -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}" >