Skip to content

Commit

Permalink
feat(cosmoz-tab): update compute-scroll-into-view
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed Apr 9, 2024
1 parent 60d27e0 commit 3ee596a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/next/cosmoz-tab.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { component, useEffect, useLayoutEffect } from '@pionjs/pion';
import { html, nothing } from 'lit-html';
import { ifDefined } from 'lit-html/directives/if-defined.js';
import computeScroll from 'compute-scroll-into-view';
import { compute } from 'compute-scroll-into-view';

import style from './cosmoz-tab.css';

Expand All @@ -22,12 +22,12 @@ const Tab = (host) => {
if (!active) {
return;
}
computeScroll(el, {
compute(el, {
block: 'nearest',
inline: 'center',
boundary: el.parentElement,
}).forEach(({ el, top, left }) =>
el.scroll({ top, left, behavior: 'smooth' })
el.scroll({ top, left, behavior: 'smooth' }),
);
}, [active]);

Expand All @@ -49,5 +49,5 @@ customElements.define(
'cosmoz-tab-next',
component(Tab, {
observedAttributes: ['active', 'badge', 'href'],
})
}),
);

0 comments on commit 3ee596a

Please sign in to comment.