Skip to content

Commit 9bbe475

Browse files
Merge pull request #860 from sudhanshutech/share/ux
fix position of share icon
2 parents d538442 + 9147141 commit 9bbe475

File tree

4 files changed

+35
-59
lines changed

4 files changed

+35
-59
lines changed

src/custom/CatalogDetail/ActionButton.tsx

Lines changed: 12 additions & 39 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';
@@ -28,8 +21,6 @@ interface ActionButtonsProps {
2821
onOpenPlaygroundClick: (designId: string, name: string) => void;
2922
showInfoAction?: boolean;
3023
handleInfoClick?: () => void;
31-
showShareAction?: boolean;
32-
handleShare: () => void;
3324
showDeleteAction?: boolean;
3425
handleDelete: () => void;
3526
}
@@ -47,8 +38,6 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
4738
onOpenPlaygroundClick,
4839
showInfoAction,
4940
handleInfoClick,
50-
showShareAction,
51-
handleShare,
5241
showDeleteAction,
5342
handleDelete
5443
}) => {
@@ -151,47 +140,31 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
151140
Edit
152141
</ActionButton>
153142
)}
154-
{showShareAction && (
155-
<ActionButton
143+
{showDeleteAction && (
144+
<UnpublishAction
156145
sx={{
157146
borderRadius: '0.2rem',
158-
backgroundColor: 'transparent',
159-
border: `1px solid ${theme.palette.border.normal}`,
160-
gap: '10px',
161-
color: charcoal[10]
147+
gap: '10px'
162148
}}
163-
onClick={handleShare}
149+
onClick={handleDelete}
164150
>
165-
<ShareLineIcon width="24" height="24" fill={theme.palette.icon.default} />
166-
Share
167-
</ActionButton>
151+
<DeleteIcon width={24} height={24} fill={charcoal[100]} />
152+
Delete
153+
</UnpublishAction>
168154
)}
169-
{showDeleteAction && (
155+
{showUnpublishAction && (
170156
<UnpublishAction
171157
sx={{
172158
borderRadius: '0.2rem',
173159
gap: '10px'
174160
}}
175-
onClick={handleDelete}
161+
onClick={handleUnpublish}
176162
>
177-
<DeleteIcon width={24} height={24} fill={charcoal[100]} />
178-
Delete
163+
<PublishIcon width={24} height={24} fill={charcoal[100]} />
164+
Unpublish
179165
</UnpublishAction>
180166
)}
181167
</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-
)}
195168
</StyledActionWrapper>
196169
);
197170
};

src/custom/CatalogDetail/LeftPanel.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ interface LeftPanelProps {
2525
onOpenPlaygroundClick: (designId: string, name: string) => void;
2626
showInfoAction?: boolean;
2727
handleInfoClick?: () => void;
28-
showShareAction?: boolean;
29-
handleShare: () => void;
3028
showDeleteAction?: boolean;
3129
handleDelete: () => void;
3230
}
@@ -49,8 +47,6 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
4947
onOpenPlaygroundClick,
5048
showInfoAction = false,
5149
handleInfoClick,
52-
showShareAction = false,
53-
handleShare,
5450
showDeleteAction = false,
5551
handleDelete
5652
}) => {
@@ -97,8 +93,6 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
9793
onOpenPlaygroundClick={onOpenPlaygroundClick}
9894
showInfoAction={showInfoAction}
9995
handleInfoClick={handleInfoClick}
100-
showShareAction={showShareAction}
101-
handleShare={handleShare}
10296
showDeleteAction={showDeleteAction}
10397
handleDelete={handleDelete}
10498
/>

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)