Skip to content

Commit 7f1a47b

Browse files
authored
Merge pull request #927 from amitamrutiya/fix-visiblity
feat: change the position of visiblity button
2 parents 949ea1b + 19e1d41 commit 7f1a47b

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

src/custom/CatalogDetail/OverviewSection.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
6969
handleCopyUrl={handleCopyUrl}
7070
showShareAction={showShareAction}
7171
handleShare={handleShare}
72-
isVisibilityEnabled={isVisibilityEnabled}
73-
handleVisibilityChange={handleVisibilityChange}
7472
/>
7573
</div>
7674
<Grid container spacing={2}>
@@ -85,7 +83,13 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
8583
/>
8684
</ContentRow>
8785
)}
88-
<UserInfo details={details} showVersion={showVersion} userProfile={userProfile} />
86+
<UserInfo
87+
details={details}
88+
showVersion={showVersion}
89+
userProfile={userProfile}
90+
isVisibilityEnabled={isVisibilityEnabled}
91+
handleVisibilityChange={handleVisibilityChange}
92+
/>
8993
</Grid>
9094
</Grid>
9195
</Grid>

src/custom/CatalogDetail/SocialSharePopper.tsx

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
import React, { useState } from 'react';
2-
3-
import {
4-
ChainIcon,
5-
FacebookIcon,
6-
LinkedinIcon,
7-
LockIcon,
8-
PublicIcon,
9-
ShareIcon,
10-
TwitterIcon
11-
} from '../../icons';
2+
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
3+
import { Box, IconButton, Menu, MenuItem, Typography } from '../../base';
4+
import { ChainIcon, FacebookIcon, LinkedinIcon, ShareIcon, TwitterIcon } from '../../icons';
125
import { useTheme } from '../../theme';
136
import { Pattern } from '../CustomCatalog/CustomCard';
147
import { CustomTooltip } from '../CustomTooltip';
158
import { ErrorBoundary } from '../ErrorBoundary';
16-
17-
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
18-
import { Box, IconButton, Menu, MenuItem, Typography } from '../../base';
19-
import { VisibilityChipMenu } from '../VisibilityChipMenu';
20-
import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu';
219
import { CopyShareIconWrapper, ShareButton, ShareButtonGroup, ShareSideButton } from './style';
2210

2311
interface SocialSharePopperProps {
@@ -29,8 +17,6 @@ interface SocialSharePopperProps {
2917
handleCopyUrl: (type: string, name: string, id: string) => void;
3018
showShareAction: boolean;
3119
handleShare: () => void;
32-
isVisibilityEnabled: boolean;
33-
handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void;
3420
}
3521

3622
const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
@@ -40,9 +26,7 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
4026
title,
4127
getUrl,
4228
handleCopyUrl,
43-
handleShare,
44-
isVisibilityEnabled,
45-
handleVisibilityChange
29+
handleShare
4630
}) => {
4731
const theme = useTheme();
4832
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
@@ -61,16 +45,6 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
6145
return (
6246
<ErrorBoundary>
6347
<CopyShareIconWrapper style={{ marginBottom: '2rem' }}>
64-
<VisibilityChipMenu
65-
value={details?.visibility as VIEW_VISIBILITY}
66-
onChange={(value) => handleVisibilityChange(value as VIEW_VISIBILITY)}
67-
enabled={isVisibilityEnabled}
68-
options={[
69-
[VIEW_VISIBILITY.PUBLIC, PublicIcon],
70-
[VIEW_VISIBILITY.PRIVATE, LockIcon]
71-
]}
72-
/>
73-
7448
<ShareButtonGroup variant="contained">
7549
<CustomTooltip title="Change access and visibility">
7650
<ShareButton variant="contained" onClick={handleShare}>

src/custom/CatalogDetail/UserInfo.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Avatar } from '../../base';
22
import { CLOUD_URL } from '../../constants/constants';
3+
import { LockIcon, PublicIcon } from '../../icons';
34
import { Pattern } from '../CustomCatalog/CustomCard';
45
import { getVersion } from '../CustomCatalog/Helper';
6+
import { VisibilityChipMenu } from '../VisibilityChipMenu';
7+
import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu';
58
import { formatDate } from './helper';
69
import { ContentDetailsPoints, ContentDetailsText, ContentRow, RedirectLink } from './style';
710
import { UserProfile } from './types';
@@ -10,9 +13,17 @@ interface UserInfoProps {
1013
details: Pattern;
1114
showVersion?: boolean;
1215
userProfile?: UserProfile;
16+
isVisibilityEnabled: boolean;
17+
handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void;
1318
}
1419

15-
const UserInfo: React.FC<UserInfoProps> = ({ details, showVersion = true, userProfile }) => {
20+
const UserInfo: React.FC<UserInfoProps> = ({
21+
details,
22+
showVersion = true,
23+
userProfile,
24+
isVisibilityEnabled,
25+
handleVisibilityChange
26+
}) => {
1627
return (
1728
<>
1829
<ContentRow>
@@ -57,6 +68,18 @@ const UserInfo: React.FC<UserInfoProps> = ({ details, showVersion = true, userPr
5768
<ContentDetailsText>{getVersion(details)}</ContentDetailsText>
5869
</ContentRow>
5970
)}
71+
<ContentRow>
72+
<ContentDetailsPoints>VISIBILITY</ContentDetailsPoints>
73+
<VisibilityChipMenu
74+
value={details?.visibility as VIEW_VISIBILITY}
75+
onChange={(value) => handleVisibilityChange(value as VIEW_VISIBILITY)}
76+
enabled={isVisibilityEnabled}
77+
options={[
78+
[VIEW_VISIBILITY.PUBLIC, PublicIcon],
79+
[VIEW_VISIBILITY.PRIVATE, LockIcon]
80+
]}
81+
/>
82+
</ContentRow>
6083
</>
6184
);
6285
};

src/custom/VisibilityChipMenu/VisibilityChipMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ const StyledMenu = styled(Menu)(({ theme }) => ({
4646
}));
4747

4848
const StyledButton = styled(Button)(() => ({
49-
padding: '0px',
50-
width: '100%'
49+
padding: '0px'
5150
}));
5251

5352
const StyledDiv = styled('div')(

0 commit comments

Comments
 (0)