mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-07-30 09:48:47 -04:00
Add customizable icon support to CopyLinkOrShareButton and update profile sharing icon
- Introduced `icon` prop to `CopyLinkOrShareButton` for greater flexibility. - Updated `ShareProfileButton` to use `ShareIcon` for improved clarity and visual consistency.
This commit is contained in:
@@ -2,7 +2,7 @@ import {CheckIcon, ClipboardIcon, DocumentDuplicateIcon} from '@heroicons/react/
|
||||
import {LinkIcon} from '@heroicons/react/24/solid'
|
||||
import clsx from 'clsx'
|
||||
import {getXShareProfileUrl} from 'common/socials'
|
||||
import {ComponentProps, useState} from 'react'
|
||||
import {ComponentProps, ComponentType, SVGProps, useState} from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import {Button, ColorType, IconButton, SizeType} from 'web/components/buttons/button'
|
||||
import {useT} from 'web/lib/locale'
|
||||
@@ -23,11 +23,14 @@ export function CopyLinkOrShareButton(props: {
|
||||
color?: ColorType
|
||||
/** Optional OS-share-sheet content. When omitted, `mobileShare` uses its generic profile copy. */
|
||||
shareData?: {title?: string; text?: string}
|
||||
/** Idle-state icon. Defaults to the link glyph; pass `ShareIcon` where the button reads as "share". */
|
||||
icon?: ComponentType<SVGProps<SVGSVGElement>>
|
||||
trackingInfo?: {
|
||||
contractId: string
|
||||
}
|
||||
}) {
|
||||
const {url, size, children, className, iconClassName, tooltip, color, shareData} = props
|
||||
const Icon = props.icon ?? LinkIcon
|
||||
const [isSuccess, setIsSuccess] = useState(false)
|
||||
const t = useT()
|
||||
|
||||
@@ -70,7 +73,7 @@ export function CopyLinkOrShareButton(props: {
|
||||
aria-hidden="true"
|
||||
/>
|
||||
) : (
|
||||
<LinkIcon
|
||||
<Icon
|
||||
strokeWidth={'2.5'}
|
||||
className={clsx(iconClassName, 'h-[1.1rem]')}
|
||||
aria-hidden="true"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {ShareIcon} from '@heroicons/react/24/outline'
|
||||
import clsx from 'clsx'
|
||||
import {ENV_CONFIG} from 'common/envs/constants'
|
||||
import {ColorType} from 'web/components/buttons/button'
|
||||
@@ -33,6 +34,7 @@ export const ShareProfileButton = (props: {
|
||||
eventTrackingName="shareprofile"
|
||||
color={color}
|
||||
size="sm"
|
||||
icon={ShareIcon}
|
||||
iconClassName={'hidden sm:inline'}
|
||||
// Same three-beat framing as the /about "Share Compass" message, trimmed to one line for a
|
||||
// single-profile share: what Compass is, and why this profile is worth a look.
|
||||
|
||||
Reference in New Issue
Block a user