mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
Initial commit
This commit is contained in:
commit
1f8d8f5b68
31 changed files with 4523 additions and 0 deletions
51
src/components/Icon.tsx
Normal file
51
src/components/Icon.tsx
Normal file
|
@ -0,0 +1,51 @@
|
|||
import { socials } from '@/components/data/Socials'
|
||||
import copy from 'copy-to-clipboard'
|
||||
import toast from 'react-hot-toast'
|
||||
import Link from 'next/link'
|
||||
|
||||
type Icon = {
|
||||
children: React.ReactNode
|
||||
reference: string
|
||||
copyValue?: boolean
|
||||
}
|
||||
|
||||
const notify = () => {
|
||||
toast.remove(),
|
||||
toast.success('Copied to clipboard', {
|
||||
style: {
|
||||
background: '#0f1012',
|
||||
color: '#fff',
|
||||
fontSize: '1em',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const Icon = ({ children, reference, copyValue }: Icon) => {
|
||||
if (copyValue) {
|
||||
return (
|
||||
<Link
|
||||
href={''}
|
||||
className={`cursor-pointer`}
|
||||
aria-label={
|
||||
socials.find((social) => social.ref === reference)?.ariaLabel
|
||||
}
|
||||
onClick={() => {
|
||||
notify(), copy(reference)
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={reference}
|
||||
target='_blank'
|
||||
className={'cursor-pointer'}
|
||||
aria-label={socials.find((social) => social.ref === reference)?.ariaLabel}
|
||||
>
|
||||
{children}
|
||||
</Link>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue