diff --git a/src/components/CodeSnippet/CodeSnippet.Story.svelte b/src/components/CodeSnippet/CodeSnippet.Story.svelte
index 2d5d2b04..229f6225 100644
--- a/src/components/CodeSnippet/CodeSnippet.Story.svelte
+++ b/src/components/CodeSnippet/CodeSnippet.Story.svelte
@@ -5,31 +5,27 @@
import Layout from '../../internal/ui/Layout.svelte';
import CodeSnippet from './CodeSnippet.svelte';
import CodeSnippetSkeleton from './CodeSnippet.Skeleton.svelte';
-
- const inlineProps = { light, feedback, copyLabel };
- const singleLineProps = {
- feedback,
- copyButtonDescription,
- 'aria-label': $$props['aria-label']
- };
- const multiLineProps = { feedback, showLessText, showMoreText };
{#if story === 'skeleton'}
-
+
{:else if story === 'inline'}
-
{'node -v'}
+
{'node -v'}
{:else if story === 'single line'}
-
+
{'node -v Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, veritatis voluptate id incidunt molestiae officia possimus, quasi itaque alias, architecto hic, dicta fugit? Debitis delectus quidem explicabo vitae fuga laboriosam!'}
{:else if story === 'multi line'}
-
+
{`@mixin grid-container {
width: 100%;
padding-right: padding(mobile);
diff --git a/src/components/CodeSnippet/CodeSnippet.svelte b/src/components/CodeSnippet/CodeSnippet.svelte
index e57271c7..5a59e6b2 100644
--- a/src/components/CodeSnippet/CodeSnippet.svelte
+++ b/src/components/CodeSnippet/CodeSnippet.svelte
@@ -10,7 +10,6 @@
export let light = false;
export let props = {};
- import { onMount } from 'svelte';
import ChevronDown16 from 'carbon-icons-svelte/lib/ChevronDown16';
import { cx } from '../../lib';
import Button from '../Button';
@@ -20,18 +19,16 @@
const id = Math.random();
let codeRef = undefined;
let expandedCode = false;
- let shouldShowMoreLessBtn = false;
-
- onMount(() => {
- if (codeRef) {
- const { height } = codeRef.getBoundingClientRect();
- shouldShowMoreLessBtn = type === 'multi' && height > 255;
- }
- });
+ let showMoreLessBtn = false;
+ $: if (codeRef) {
+ const { height } = codeRef.getBoundingClientRect();
+ showMoreLessBtn = type === 'multi' && height > 255;
+ }
$: _class = cx(
'--snippet',
type && `--snippet--${type}`,
+ type === 'inline' && '--btn--copy',
expandedCode && '--snippet--expand',
light && '--snippet--light',
className
@@ -64,8 +61,12 @@
-
- {#if shouldShowMoreLessBtn}
+
+ {#if showMoreLessBtn}