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