stacker.news/components/info.js

23 lines
592 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)
}}
2024-03-05 22:27:29 +00:00
className='d-flex align-items-center 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
)
}