mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
refactor(code-snippet): replace afterUpdate with reactive statement
This commit is contained in:
parent
12ff171784
commit
4bbc50c460
1 changed files with 3 additions and 7 deletions
|
@ -86,7 +86,6 @@
|
||||||
*/
|
*/
|
||||||
export let ref = null;
|
export let ref = null;
|
||||||
|
|
||||||
import { afterUpdate } from "svelte";
|
|
||||||
import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16";
|
import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16";
|
||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
import { Copy } from "../Copy";
|
import { Copy } from "../Copy";
|
||||||
|
@ -94,12 +93,9 @@
|
||||||
import CodeSnippetSkeleton from "./CodeSnippet.Skeleton.svelte";
|
import CodeSnippetSkeleton from "./CodeSnippet.Skeleton.svelte";
|
||||||
|
|
||||||
$: expandText = expanded ? showLessText : showMoreText;
|
$: expandText = expanded ? showLessText : showMoreText;
|
||||||
|
$: if (type === "multi" && ref) {
|
||||||
afterUpdate(() => {
|
showMoreLess = ref.getBoundingClientRect().height > 255;
|
||||||
if (type === "multi" && ref) {
|
}
|
||||||
showMoreLess = ref.getBoundingClientRect().height > 255;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if skeleton}
|
{#if skeleton}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue