18 lines
485 B
TypeScript
18 lines
485 B
TypeScript
import { $currentPage } from "@/scripts/currentPage"
|
|
import type { ComponentProps, ParentComponent } from "solid-js";
|
|
import { splitProps } from "solid-js";
|
|
|
|
type RequireProps = {
|
|
href: string,
|
|
};
|
|
|
|
const PageLink: ParentComponent<ComponentProps<"a"> & RequireProps> = (props) => {
|
|
const [local, others] = splitProps(props, ["children"]);
|
|
return (
|
|
<a {...others} onClick={() => $currentPage.set(others.href)}>
|
|
{local.children}
|
|
</a>
|
|
);
|
|
};
|
|
|
|
export default PageLink;
|