mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
parent
04b8978ec2
commit
662c7b7fde
1 changed files with 7 additions and 10 deletions
|
@ -11,7 +11,7 @@
|
|||
export let tileMaxHeight = 0;
|
||||
export let tilePadding = 0;
|
||||
|
||||
import { onMount, afterUpdate } from 'svelte';
|
||||
import { afterUpdate } from 'svelte';
|
||||
import ChevronDown16 from 'carbon-icons-svelte/lib/ChevronDown16';
|
||||
import { cx, css } from '../../lib';
|
||||
|
||||
|
@ -19,20 +19,17 @@
|
|||
let contentRef = undefined;
|
||||
let aboveRef = undefined;
|
||||
|
||||
onMount(() => {
|
||||
afterUpdate(() => {
|
||||
if (tileMaxHeight === 0) {
|
||||
tileMaxHeight = aboveRef.getBoundingClientRect().height;
|
||||
}
|
||||
|
||||
const style = window.getComputedStyle(tileRef);
|
||||
|
||||
tileMaxHeight = aboveRef.getBoundingClientRect().height;
|
||||
tilePadding =
|
||||
parseInt(style.getPropertyValue('padding-top'), 10) +
|
||||
parseInt(style.getPropertyValue('padding-bottom'), 10);
|
||||
});
|
||||
|
||||
afterUpdate(() => {
|
||||
tileMaxHeight = expanded
|
||||
? contentRef.getBoundingClientRect().height
|
||||
: aboveRef.getBoundingClientRect().height;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue