typescript component cleanup
This commit is contained in:
parent
03d58a4fc0
commit
70aa44e2f6
|
@ -1,11 +1,11 @@
|
|||
import { For, onMount } from "solid-js";
|
||||
import { For, onMount, type Component } from "solid-js";
|
||||
import { useStore } from "@nanostores/solid";
|
||||
import { $currentPage } from "@/scripts/currentPage"
|
||||
|
||||
interface Page {
|
||||
type Page = {
|
||||
path: string,
|
||||
name: string,
|
||||
}
|
||||
};
|
||||
|
||||
const pages: Page[] = [
|
||||
{ path: "/", name: "about" },
|
||||
|
@ -17,7 +17,7 @@ const inactiveClasses = "text-xl text-fg_light transition-all duration-300 hover
|
|||
const activeClasses = "font-bold !text-foreground";
|
||||
|
||||
|
||||
const Nav = () => {
|
||||
const Nav: Component = () => {
|
||||
const currentPage = useStore($currentPage);
|
||||
|
||||
onMount(() => {
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import { $currentPage } from "@/scripts/currentPage"
|
||||
import type { ParentComponent } from "solid-js";
|
||||
import type { ComponentProps, ParentComponent } from "solid-js";
|
||||
import { splitProps } from "solid-js";
|
||||
|
||||
interface Props {
|
||||
type RequireProps = {
|
||||
href: string,
|
||||
class?: string,
|
||||
}
|
||||
};
|
||||
|
||||
const PageLink: ParentComponent<Props> = (props) => {
|
||||
const PageLink: ParentComponent<ComponentProps<"a"> & RequireProps> = (props) => {
|
||||
const [local, others] = splitProps(props, ["children"]);
|
||||
return (
|
||||
<a {...others} onClick={() => $currentPage.set(others.href)}>
|
||||
|
|
Loading…
Reference in a new issue