mirror of
https://github.com/lux-tel/websites.git
synced 2026-10-30 20:31:36 +00:00
29 lines
697 B
TypeScript
29 lines
697 B
TypeScript
'use client';
|
|
|
|
import { usePathname } from 'next/navigation';
|
|
import { useEffect } from 'react';
|
|
|
|
type RouterResetInputProps = {
|
|
id: string;
|
|
className?: string;
|
|
};
|
|
|
|
export default function RouterResetInput({ id, className }: RouterResetInputProps) {
|
|
const pathname = usePathname();
|
|
|
|
const setCheckboxToFalse = () => {
|
|
const input = document.getElementById(id);
|
|
if (input && 'checked' in input) {
|
|
if (input.checked) {
|
|
input.checked = false;
|
|
}
|
|
}
|
|
};
|
|
|
|
// biome-ignore lint/correctness/useExhaustiveDependencies: This is fine
|
|
useEffect(() => {
|
|
setCheckboxToFalse();
|
|
}, [pathname]);
|
|
return <input id={id} type="checkbox" className={className} />;
|
|
}
|