Tom Butcher 8ac04ac0bc Implement Tooltip System and Enhance UI Components
- Introduced a new Tooltip component to standardize tooltip functionality across the application, improving consistency and usability.
- Refactored existing components to utilize the new Tooltip implementation, enhancing user interactions with clearer feedback.
- Added a CursorTooltip for dynamic tooltip positioning based on mouse movement, improving user experience.
- Updated CSS styles for tooltips and related components to enhance visual clarity and responsiveness.
- Integrated TooltipProvider to manage tooltip state and visibility, streamlining tooltip management across the application.
2026-08-20 20:14:51 +01:00

59 lines
1.5 KiB
JavaScript

import PropTypes from 'prop-types'
import { Typography, Flex, Button } from 'antd'
import Tooltip from './Tooltip'
import NewMailIcon from '../../Icons/NewMailIcon'
// import CopyIcon from './CopyIcon'
import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text, Link } = Typography
const EmailDisplay = ({ email, showCopy = true, showLink = false }) => {
if (!email) return <Text type='secondary'>n/a</Text>
return (
<>
<Flex style={{ minWidth: 0 }}>
{showLink ? (
<Link href={`mailto:${email}`} style={{ marginRight: 8 }}>
{email}
</Link>
) : (
<>
<ElipsisText style={{ marginRight: 8 }}>
{email}
</ElipsisText>
<Tooltip title='Email'>
<Button
icon={<NewMailIcon />}
type='text'
size='small'
style={{ minWidth: 25 }}
onClick={(e) => {
e.preventDefault()
window.location.href = `mailto:${email}`
}}
/>
</Tooltip>
</>
)}
{showCopy && (
<CopyButton
text={email}
tooltip='Copy Email'
style={{ marginLeft: 0 }}
/>
)}
</Flex>
</>
)
}
EmailDisplay.propTypes = {
email: PropTypes.string,
showCopy: PropTypes.bool,
showLink: PropTypes.bool
}
export default EmailDisplay