stacker.news/components/info.js

23 lines
566 B
JavaScript
Raw Normal View History

import React from 'react'
2022-04-18 16:08:58 +00:00
import InfoIcon from '../svgs/information-fill.svg'
import { useShowModal } from './modal'
2022-04-18 16:08:58 +00:00
export default function Info ({ children, label, iconClassName = 'fill-theme-color' }) {
const showModal = useShowModal()
2022-04-18 16:08:58 +00:00
return (
<div
onClick={(e) => {
e.preventDefault()
showModal(onClose => children)
}}
className='pointer'
>
<InfoIcon
width={18} height={18} className={`${iconClassName} mx-1`}
/>
{label && <small className='text-muted'>{label}</small>}
</div>
2022-04-18 16:08:58 +00:00
)
}