mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 07:37:10 +00:00
22 lines
607 B
TypeScript
22 lines
607 B
TypeScript
import { Octicon } from './index.js'
|
|
|
|
interface Props {
|
|
link?: string,
|
|
icon?: keyof typeof Octicon,
|
|
label?: string,
|
|
tooltip?: string,
|
|
tooltipLoc?: 'se' | 'sw' | 'nw',
|
|
swapped?: boolean,
|
|
}
|
|
export function BtnLink({ link, icon, label, tooltip, tooltipLoc, swapped }: Props) {
|
|
return <a {...link ? { href: link } : { disabled: true }} class={`btn btn-link${tooltip ? ` tooltipped tip-${tooltipLoc ?? 'sw'}` : ''}`} aria-label={tooltip}>
|
|
{swapped ? <>
|
|
{label && <span>{label}</span>}
|
|
{icon && Octicon[icon]}
|
|
</> : <>
|
|
{icon && Octicon[icon]}
|
|
{label && <span>{label}</span>}
|
|
</>}
|
|
</a>
|
|
}
|