mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
fix(code-snippet): set min/max height for multi-line code snippet #656
Fixes #656
This commit is contained in:
parent
ababba1c42
commit
7fdab99812
1 changed files with 3 additions and 0 deletions
|
@ -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}">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue