Files
misode.github.io/src/app/components/Btn.tsx
Misode a5a08fc935 Implement link sharing (#213)
* Implement link sharing

* Share default

* Compress and base64 encode data

* Better error messages

* Fix build

* Only change version when it's different
2022-03-19 19:26:39 +01:00

19 lines
629 B
TypeScript

import { Octicon } from '.'
type BtnProps = {
icon?: keyof typeof Octicon,
label?: string,
active?: boolean,
tooltip?: string,
tooltipLoc?: 'se' | 'sw' | 'nw',
showTooltip?: boolean,
class?: string,
onClick?: (event: MouseEvent) => unknown,
}
export function Btn({ icon, label, active, class: clazz, tooltip, tooltipLoc, onClick }: BtnProps) {
return <div class={`btn${active ? ' active' : ''}${clazz ? ` ${clazz}` : ''}${tooltip ? ` tooltipped tip-${tooltipLoc ?? 'sw'}` : ''}${active ? ' tip-shown' : ''}`} onClick={onClick} aria-label={tooltip}>
{icon && Octicon[icon]}
{label && <span>{label}</span>}
</div>
}