Home: fix minor type error
This commit is contained in:
parent
14beef39c2
commit
157fbade81
1 changed files with 4 additions and 4 deletions
|
@ -4,6 +4,7 @@ import {
|
|||
onMount,
|
||||
type ParentComponent,
|
||||
createRenderEffect,
|
||||
createEffect,
|
||||
} from "solid-js";
|
||||
import { useDocumentTitle } from "../utils";
|
||||
import Scaffold from "~material/Scaffold";
|
||||
|
@ -58,6 +59,7 @@ const Home: ParentComponent = (props) => {
|
|||
const recalculateTabIndicator = () => {
|
||||
scrollEventLockReleased = false;
|
||||
try {
|
||||
if (!panelList!) return;
|
||||
const { x: panelX, width: panelWidth } =
|
||||
panelList.getBoundingClientRect();
|
||||
let minIdx = +Infinity,
|
||||
|
@ -95,11 +97,9 @@ const Home: ParentComponent = (props) => {
|
|||
}
|
||||
};
|
||||
|
||||
createRenderEffect(() => {
|
||||
createEffect(() => {
|
||||
makeEventListener(window, "resize", requestRecalculateTabIndicator);
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
requestAnimationFrame(recalculateTabIndicator);
|
||||
});
|
||||
|
||||
|
@ -110,7 +110,7 @@ const Home: ParentComponent = (props) => {
|
|||
};
|
||||
|
||||
const onTabClick = (idx: number) => {
|
||||
const items = panelList.querySelectorAll(".tab-panel");
|
||||
const items = panelList!.querySelectorAll(".tab-panel");
|
||||
if (items.length > idx) {
|
||||
items.item(idx).scrollIntoView({ block: "start", behavior: "smooth" });
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue