Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: "invalid hook call" on astro build #458

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions www/src/components/navigation/MobileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const NavLink: React.FC<{
</a>
);

const MobileMenu = () => {
export default function MobileMenu() {
const $isMobileMenuOpen = useStore(MobileMenuState);
return (
<>
Expand All @@ -47,6 +47,4 @@ const MobileMenu = () => {
</div>
</>
);
};

export default MobileMenu;
}
6 changes: 2 additions & 4 deletions www/src/components/navigation/MobileMenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useStore } from "@nanostores/react";
import { MobileMenuState } from "./MobileMenu";

const MobileMenuButton = () => {
export default function MobileMenuButton() {
const $isMobileMenuOpen = useStore(MobileMenuState);
return (
<>
Expand Down Expand Up @@ -33,6 +33,4 @@ const MobileMenuButton = () => {
</button>
</>
);
};

export default MobileMenuButton;
}
6 changes: 2 additions & 4 deletions www/src/components/navigation/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useDocSearchKeyboardEvents =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(docSearchReact as any).default.useDocSearchKeyboardEvents;

const Search: React.FC = () => {
export default function Search() {
const [isOpen, setIsOpen] = useState(false);
const searchButtonRef = useRef<HTMLButtonElement>(null);
const [initialQuery, setInitialQuery] = useState("");
Expand Down Expand Up @@ -103,6 +103,4 @@ const Search: React.FC = () => {
)}
</>
);
};

export default Search;
}
10 changes: 6 additions & 4 deletions www/src/components/navigation/SidebarToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
import clsx from "clsx";
import { useRef } from "react";

const SidebarToggle: React.FC<{ currentPage: string }> = ({ currentPage }) => {
export default function SidebarToggle({
currentPage,
}: {
currentPage: string;
}) {
const ref = useRef<HTMLButtonElement | null>(null);
const isLanding = currentPage === "/";

Expand Down Expand Up @@ -43,6 +47,4 @@ const SidebarToggle: React.FC<{ currentPage: string }> = ({ currentPage }) => {
<span className="sr-only">Toggle sidebar</span>
</button>
);
};

export default SidebarToggle;
}