Skip to content

Commit be52d8b

Browse files
committed
fix(shareIcon): fix position
Signed-off-by: Sudhanshu Dasgupta <[email protected]>
1 parent d538442 commit be52d8b

File tree

3 files changed

+35
-51
lines changed

3 files changed

+35
-51
lines changed

src/custom/CatalogDetail/ActionButton.tsx

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import React from 'react';
22
import { CircularProgress } from '../../base';
3-
import {
4-
CopyIcon,
5-
DeleteIcon,
6-
EditIcon,
7-
KanvasIcon,
8-
PublishIcon,
9-
ShareLineIcon
10-
} from '../../icons';
3+
import { CopyIcon, DeleteIcon, EditIcon, KanvasIcon, PublishIcon } from '../../icons';
114
import Download from '../../icons/Download/Download';
125
import { charcoal, useTheme } from '../../theme';
136
import { Pattern } from '../CustomCatalog/CustomCard';
@@ -47,8 +40,6 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
4740
onOpenPlaygroundClick,
4841
showInfoAction,
4942
handleInfoClick,
50-
showShareAction,
51-
handleShare,
5243
showDeleteAction,
5344
handleDelete
5445
}) => {
@@ -151,47 +142,31 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
151142
Edit
152143
</ActionButton>
153144
)}
154-
{showShareAction && (
155-
<ActionButton
145+
{showDeleteAction && (
146+
<UnpublishAction
156147
sx={{
157148
borderRadius: '0.2rem',
158-
backgroundColor: 'transparent',
159-
border: `1px solid ${theme.palette.border.normal}`,
160-
gap: '10px',
161-
color: charcoal[10]
149+
gap: '10px'
162150
}}
163-
onClick={handleShare}
151+
onClick={handleDelete}
164152
>
165-
<ShareLineIcon width="24" height="24" fill={theme.palette.icon.default} />
166-
Share
167-
</ActionButton>
153+
<DeleteIcon width={24} height={24} fill={charcoal[100]} />
154+
Delete
155+
</UnpublishAction>
168156
)}
169-
{showDeleteAction && (
157+
{showUnpublishAction && (
170158
<UnpublishAction
171159
sx={{
172160
borderRadius: '0.2rem',
173161
gap: '10px'
174162
}}
175-
onClick={handleDelete}
163+
onClick={handleUnpublish}
176164
>
177-
<DeleteIcon width={24} height={24} fill={charcoal[100]} />
178-
Delete
165+
<PublishIcon width={24} height={24} fill={charcoal[100]} />
166+
Unpublish
179167
</UnpublishAction>
180168
)}
181169
</div>
182-
183-
{showUnpublishAction && (
184-
<UnpublishAction
185-
sx={{
186-
borderRadius: '0.2rem',
187-
gap: '10px'
188-
}}
189-
onClick={handleUnpublish}
190-
>
191-
<PublishIcon width={24} height={24} fill={charcoal[100]} />
192-
Unpublish
193-
</UnpublishAction>
194-
)}
195170
</StyledActionWrapper>
196171
);
197172
};

src/custom/CatalogDetail/SocialSharePopper.tsx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Box, IconButton, Menu, MenuItem } from '@mui/material';
21
import React, { useState } from 'react';
3-
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
42

53
import {
64
ChainIcon,
@@ -16,9 +14,11 @@ import { Pattern } from '../CustomCatalog/CustomCard';
1614
import { CustomTooltip } from '../CustomTooltip';
1715
import { ErrorBoundary } from '../ErrorBoundary';
1816

17+
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
18+
import { Box, IconButton, Menu, MenuItem, Typography } from '../../base';
1919
import { VisibilityChipMenu } from '../VisibilityChipMenu';
2020
import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu';
21-
import { CopyShareIconWrapper } from './style';
21+
import { CopyShareIconWrapper, ShareButton, ShareButtonGroup, ShareSideButton } from './style';
2222

2323
interface SocialSharePopperProps {
2424
details: Pattern;
@@ -37,7 +37,8 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
3737
cardId,
3838
title,
3939
getUrl,
40-
handleCopyUrl
40+
handleCopyUrl,
41+
handleShare
4142
}) => {
4243
const theme = useTheme();
4344
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
@@ -66,14 +67,22 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
6667
]}
6768
/>
6869

69-
<CustomTooltip title="Copy Link" placement="top" arrow>
70-
<IconButton
71-
sx={{ borderRadius: '0.1rem', padding: '0.5rem' }}
72-
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
73-
>
74-
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.secondary} />
75-
</IconButton>
76-
</CustomTooltip>
70+
<ShareButtonGroup variant="contained">
71+
<CustomTooltip title="Change access and visibility">
72+
<ShareButton variant="contained" onClick={handleShare}>
73+
<Typography>Share</Typography>
74+
</ShareButton>
75+
</CustomTooltip>
76+
<CustomTooltip title="Copy link to design">
77+
<ShareSideButton
78+
variant="contained"
79+
size="small"
80+
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
81+
>
82+
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.inverse} />
83+
</ShareSideButton>
84+
</CustomTooltip>
85+
</ShareButtonGroup>
7786

7887
{(details?.visibility === 'published' || details?.visibility === 'public') && (
7988
<>

src/icons/Chain/ChainIcon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const ChainIcon: React.FC<ChainIconProps> = ({ width, height, style, fill = '#3C
1212
<svg
1313
width={width}
1414
height={height}
15-
viewBox="0 0 34 18"
15+
viewBox="0 0 24 24"
1616
fill={fill}
1717
xmlns="http://www.w3.org/2000/svg"
1818
style={style}
1919
>
20-
<path d="M3.95098 9.00094C3.95098 6.16576 6.2556 3.86114 9.09078 3.86114H15.7228V0.710938H9.09078C4.5147 0.710938 0.800781 4.42486 0.800781 9.00094C0.800781 13.577 4.5147 17.2909 9.09078 17.2909H15.7228V14.1407H9.09078C6.2556 14.1407 3.95098 11.8361 3.95098 9.00094ZM10.7488 10.6589H24.0128V7.34294H10.7488V10.6589ZM25.6708 0.710938H19.0388V3.86114H25.6708C28.506 3.86114 30.8106 6.16576 30.8106 9.00094C30.8106 11.8361 28.506 14.1407 25.6708 14.1407H19.0388V17.2909H25.6708C30.2469 17.2909 33.9608 13.577 33.9608 9.00094C33.9608 4.42486 30.2469 0.710938 25.6708 0.710938Z" />
20+
<path d="M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z" />
2121
</svg>
2222
);
2323

0 commit comments

Comments
 (0)