11import { Box , IconButton , Menu , MenuItem } from '@mui/material' ;
22import React , { useState } from 'react' ;
33import { FacebookShareButton , LinkedinShareButton , TwitterShareButton } from 'react-share' ;
4+ import { Typography } from '../../base' ;
45import { ChainIcon , FacebookIcon , LinkedinIcon , ShareIcon , TwitterIcon } from '../../icons' ;
56import { useTheme } from '../../theme' ;
67import { Pattern } from '../CustomCatalog/CustomCard' ;
78import { CustomTooltip } from '../CustomTooltip' ;
89import { ErrorBoundary } from '../ErrorBoundary' ;
9- import { CopyShareIconWrapper , VisibilityChip } from './style' ;
10+ import {
11+ CopyShareIconWrapper ,
12+ ShareButton ,
13+ ShareButtonGroup ,
14+ ShareSideButton ,
15+ VisibilityChip
16+ } from './style' ;
1017
1118interface SocialSharePopperProps {
1219 details : Pattern ;
@@ -15,6 +22,8 @@ interface SocialSharePopperProps {
1522 title : string ;
1623 getUrl : ( type : string , id : string ) => string ;
1724 handleCopyUrl : ( type : string , name : string , id : string ) => void ;
25+ showShareAction : boolean ;
26+ handleShare : ( ) => void ;
1827}
1928
2029const SocialSharePopper : React . FC < SocialSharePopperProps > = ( {
@@ -23,7 +32,9 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
2332 cardId,
2433 title,
2534 getUrl,
26- handleCopyUrl
35+ handleCopyUrl,
36+ showShareAction,
37+ handleShare
2738} ) => {
2839 const theme = useTheme ( ) ;
2940 const [ anchorEl , setAnchorEl ] = useState < null | HTMLElement > ( null ) ;
@@ -50,15 +61,36 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
5061 { details ?. visibility }
5162 </ VisibilityChip >
5263
53- { details ?. visibility !== 'private' && (
54- < CustomTooltip title = "Copy Link" placement = "top" arrow >
55- < IconButton
56- sx = { { borderRadius : '0.1rem' , padding : '0.5rem' } }
57- onClick = { ( ) => handleCopyUrl ( cleanedType , details ?. name , details ?. id ) }
58- >
59- < ChainIcon height = { '24' } width = { '24' } fill = { theme . palette . icon . secondary } />
60- </ IconButton >
61- </ CustomTooltip >
64+ { showShareAction ? (
65+ < ShareButtonGroup variant = "contained" >
66+ < CustomTooltip title = "Change access and visibility" >
67+ < ShareButton variant = "contained" onClick = { handleShare } >
68+ < Typography > Share</ Typography >
69+ </ ShareButton >
70+ </ CustomTooltip >
71+ < CustomTooltip title = "Copy link to design" >
72+ < ShareSideButton
73+ variant = "contained"
74+ size = "small"
75+ onClick = { ( ) => handleCopyUrl ( cleanedType , details ?. name , details ?. id ) }
76+ >
77+ < ChainIcon height = { '24' } width = { '24' } fill = { theme . palette . icon . inverse } />
78+ </ ShareSideButton >
79+ </ CustomTooltip >
80+ </ ShareButtonGroup >
81+ ) : (
82+ < >
83+ { details ?. visibility !== 'private' && (
84+ < CustomTooltip title = "Copy Link" placement = "top" arrow >
85+ < IconButton
86+ sx = { { borderRadius : '0.1rem' , padding : '0.5rem' } }
87+ onClick = { ( ) => handleCopyUrl ( cleanedType , details ?. name , details ?. id ) }
88+ >
89+ < ChainIcon height = { '24' } width = { '24' } fill = { theme . palette . icon . secondary } />
90+ </ IconButton >
91+ </ CustomTooltip >
92+ ) }
93+ </ >
6294 ) }
6395
6496 { ( details ?. visibility === 'published' || details ?. visibility === 'public' ) && (
0 commit comments