1
Fork 0
mirror of https://github.com/Steffo99/steffoweb.git synced 2024-11-22 08:04:31 +00:00
steffoweb/components/LinkPanel.tsx

42 lines
1,023 B
TypeScript
Raw Normal View History

2022-10-16 02:33:33 +00:00
import {IconProp} from "@fortawesome/fontawesome-svg-core"
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
import {default as Link} from "next/link"
import {default as cn} from "classnames"
2022-10-16 23:58:17 +00:00
import {default as style} from "./LinkPanel.module.css"
2022-10-16 02:33:33 +00:00
import React from "react"
export type LinkPanelProps = {
href?: string,
icon: IconProp,
2022-10-16 23:58:17 +00:00
text: React.ReactNode,
2022-10-16 02:33:33 +00:00
me?: boolean,
fade?: boolean,
}
export const LinkPanel = ({href, icon, text, me, fade}: LinkPanelProps) => {
const panel = (
2023-01-16 15:50:50 +00:00
<span>
<FontAwesomeIcon icon={icon}/>&nbsp;{text}
</span>
2022-10-16 02:33:33 +00:00
)
if(href) {
return (
2023-01-16 15:51:41 +00:00
<Link href={href}>
<a className={cn({panel: true, [style.linkPanel]: true, fade: fade})} rel={me ? "me" : ""}>
2023-01-16 15:50:50 +00:00
{panel}
2023-01-16 15:51:41 +00:00
</a>
</Link>
2022-10-16 02:33:33 +00:00
)
}
else {
2023-01-16 15:50:50 +00:00
return (
<div className={cn({panel: true, fade: fade})}>
{panel}
</div>
)
2022-10-16 02:33:33 +00:00
}
}