From 25a7ceacf89adfd1bda7e552d352bb684ced60a8 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Fri, 30 Oct 2020 10:43:30 -0700 Subject: [PATCH] docs(code-snippet): simplify hidden code snippet example --- .../CodeSnippet/HiddenCodeSnippet.svelte | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/docs/src/pages/framed/CodeSnippet/HiddenCodeSnippet.svelte b/docs/src/pages/framed/CodeSnippet/HiddenCodeSnippet.svelte index 29987a3c..079d8b05 100644 --- a/docs/src/pages/framed/CodeSnippet/HiddenCodeSnippet.svelte +++ b/docs/src/pages/framed/CodeSnippet/HiddenCodeSnippet.svelte @@ -1,38 +1,32 @@ - - - -
- -

Tab 2 contains a multi-line code snippet.

-

- Inactive tab content is visually hidden but still rendered in the DOM. - As a result, the "Show more" button will not appear because the computed - height of the code element is 0. -

-

- To work around this, you can force the code snippet to be re-rendered - when the tab content is active. -

-
- -

The "Show more" button should appear.

- {#if selected === 1} - - {/if} -
-
-
+ + +{#if toggled} +
"Show more" will not render

+{/if} +
+ +
+ +{#if toggled} +

+
"Show more" will render

+ +{/if}