Skip to content

Commit

Permalink
fix(icon): use other share icon
Browse files Browse the repository at this point in the history
Signed-off-by: Sudhanshu Dasgupta <[email protected]>
  • Loading branch information
sudhanshutech committed Dec 17, 2024
1 parent 6a792e8 commit d67c431
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 60 deletions.
4 changes: 2 additions & 2 deletions src/custom/CatalogDetail/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { CircularProgress } from '../../base';
import { CopyIcon, EditIcon, KanvasIcon, PublishIcon, ShareIcon } from '../../icons';
import { CopyIcon, EditIcon, KanvasIcon, PublishIcon, ShareLineIcon } from '../../icons';
import Download from '../../icons/Download/Download';
import { charcoal, useTheme } from '../../theme';
import { Pattern } from '../CustomCatalog/CustomCard';
Expand Down Expand Up @@ -151,7 +151,7 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
}}
onClick={handleShare}
>
<ShareIcon width={24} height={24} fill={charcoal[10]} />
<ShareLineIcon width="24" height="24" fill={charcoal[10]} />
Share
</ActionButton>
)}
Expand Down
112 changes: 54 additions & 58 deletions src/custom/ShareModal/ShareModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,6 @@ const ShareModal: React.FC<ShareModalProps> = ({
}
}, [selectedResource]);

useEffect(() => {
if (selectedResource?.visibility === 'published') {
setOption(SHARE_MODE.PRIVATE); // Force set to private if published
} else {
setOption(selectedResource?.visibility);
}
}, [selectedResource]);

// Filter options dynamically to exclude PUBLIC when visibility is published
const filteredOptions =
selectedResource?.visibility === 'published' ? [SHARE_MODE.PRIVATE] : Object.values(SHARE_MODE);

return (
<div style={{ marginBottom: '1rem' }}>
<Modal
Expand All @@ -256,52 +244,60 @@ const ShareModal: React.FC<ShareModalProps> = ({
}
fetchSuggestions={fetchSuggestions}
/>
<CustomListItemText>
<Typography variant="h6">General Access</Typography>
</CustomListItemText>
<CustomDialogContentText>
<FormControlWrapper size="small">
<div style={{ display: 'flex', justifyContent: 'start', alignItems: 'center' }}>
<VisibilityIconWrapper>
{selectedOption === SHARE_MODE.PUBLIC ? (
<PublicIcon
width={24}
height={24}
stroke={theme.palette.mode === 'dark' ? WHITE : BLACK}
/>
) : (
<LockIcon
width={24}
height={24}
stroke={theme.palette.mode === 'dark' ? WHITE : BLACK}
/>
)}
</VisibilityIconWrapper>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<CustomSelect
variant="outlined"
defaultValue={selectedOption}
labelId="share-menu-select"
id="share-menu"
open={openMenu}
onClose={handleMenuClose}
onOpen={() => setMenu(true)}
onChange={handleOptionClick}
disabled={isVisibilitySelectorDisabled}
>
{filteredOptions.map((option) => (
<MenuItem key={option} selected={option === selectedOption} value={option}>
{option.charAt(0).toUpperCase() + option.slice(1)}
</MenuItem>
))}
</CustomSelect>
<Typography component="span" variant="body2">
{selectedOption === SHARE_MODE.PRIVATE ? options.PRIVATE : options.PUBLIC}
</Typography>
</div>
</div>
</FormControlWrapper>
</CustomDialogContentText>
{selectedResource?.visibility !== 'published' && (
<>
<CustomListItemText>
<Typography variant="h6">General Access</Typography>
</CustomListItemText>
<CustomDialogContentText>
<FormControlWrapper size="small">
<div style={{ display: 'flex', justifyContent: 'start', alignItems: 'center' }}>
<VisibilityIconWrapper>
{selectedOption === SHARE_MODE.PUBLIC ? (
<PublicIcon
width={24}
height={24}
stroke={theme.palette.mode === 'dark' ? WHITE : BLACK}
/>
) : (
<LockIcon
width={24}
height={24}
stroke={theme.palette.mode === 'dark' ? WHITE : BLACK}
/>
)}
</VisibilityIconWrapper>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<CustomSelect
variant="outlined"
defaultValue={selectedOption}
labelId="share-menu-select"
id="share-menu"
open={openMenu}
onClose={handleMenuClose}
onOpen={() => setMenu(true)}
onChange={handleOptionClick}
disabled={isVisibilitySelectorDisabled}
>
{Object.values(SHARE_MODE).map((option) => (
<MenuItem
key={option}
selected={option === selectedOption}
value={option}
>
{option.charAt(0).toUpperCase() + option.slice(1)}
</MenuItem>
))}
</CustomSelect>
<Typography component="span" variant="body2">
{selectedOption === SHARE_MODE.PRIVATE ? options.PRIVATE : options.PUBLIC}
</Typography>
</div>
</div>
</FormControlWrapper>
</CustomDialogContentText>
</>
)}
</ModalBody>

<ModalFooter
Expand Down

0 comments on commit d67c431

Please sign in to comment.