2021-07-31 15:57:43 +00:00
|
|
|
import type { ReactNode } from "react";
|
2021-07-31 17:22:48 +00:00
|
|
|
import { Link, useRouter } from "blitz";
|
2021-07-31 15:57:43 +00:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
2021-07-18 15:32:45 +00:00
|
|
|
import {
|
|
|
|
faPhoneAlt as fasPhone,
|
|
|
|
faTh as fasTh,
|
|
|
|
faComments as fasComments,
|
|
|
|
faCog as fasCog,
|
2021-07-31 15:57:43 +00:00
|
|
|
} from "@fortawesome/pro-solid-svg-icons";
|
2021-07-18 15:32:45 +00:00
|
|
|
import {
|
|
|
|
faPhoneAlt as farPhone,
|
|
|
|
faTh as farTh,
|
|
|
|
faComments as farComments,
|
|
|
|
faCog as farCog,
|
2021-07-31 15:57:43 +00:00
|
|
|
} from "@fortawesome/pro-regular-svg-icons";
|
2021-07-18 15:32:45 +00:00
|
|
|
|
|
|
|
export default function Footer() {
|
|
|
|
return (
|
2021-07-31 14:33:18 +00:00
|
|
|
<footer className="grid grid-cols-4" style={{ flex: "0 0 50px" }}>
|
2021-07-18 15:32:45 +00:00
|
|
|
<NavLink
|
|
|
|
label="Calls"
|
|
|
|
path="/calls"
|
|
|
|
icons={{
|
|
|
|
active: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasPhone} />,
|
|
|
|
inactive: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={farPhone} />,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<NavLink
|
|
|
|
label="Keypad"
|
|
|
|
path="/keypad"
|
|
|
|
icons={{
|
|
|
|
active: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasTh} />,
|
|
|
|
inactive: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={farTh} />,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<NavLink
|
|
|
|
label="Messages"
|
|
|
|
path="/messages"
|
|
|
|
icons={{
|
|
|
|
active: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasComments} />,
|
|
|
|
inactive: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={farComments} />,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<NavLink
|
|
|
|
label="Settings"
|
|
|
|
path="/settings"
|
|
|
|
icons={{
|
|
|
|
active: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasCog} />,
|
|
|
|
inactive: <FontAwesomeIcon size="lg" className="w-6 h-6" icon={farCog} />,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</footer>
|
2021-07-31 15:57:43 +00:00
|
|
|
);
|
2021-07-18 15:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type NavLinkProps = {
|
2021-07-31 15:57:43 +00:00
|
|
|
path: string;
|
|
|
|
label: string;
|
2021-07-18 15:32:45 +00:00
|
|
|
icons: {
|
2021-07-31 15:57:43 +00:00
|
|
|
active: ReactNode;
|
|
|
|
inactive: ReactNode;
|
|
|
|
};
|
|
|
|
};
|
2021-07-18 15:32:45 +00:00
|
|
|
|
|
|
|
function NavLink({ path, label, icons }: NavLinkProps) {
|
2021-07-31 15:57:43 +00:00
|
|
|
const router = useRouter();
|
|
|
|
const isActiveRoute = router.pathname.startsWith(path);
|
|
|
|
const icon = isActiveRoute ? icons.active : icons.inactive;
|
2021-07-18 15:32:45 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="flex flex-col items-center justify-around h-full">
|
|
|
|
<Link href={path}>
|
|
|
|
<a className="flex flex-col items-center">
|
|
|
|
{icon}
|
|
|
|
<span className="text-xs">{label}</span>
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
</div>
|
2021-07-31 15:57:43 +00:00
|
|
|
);
|
2021-07-18 15:32:45 +00:00
|
|
|
}
|