Skip to content

Commit

Permalink
Merge pull request #835 from sudhanshutech/ui/share
Browse files Browse the repository at this point in the history
fix share button UI
  • Loading branch information
sudhanshutech authored Dec 3, 2024
2 parents f2edeb6 + d1bfe20 commit c325637
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
31 changes: 24 additions & 7 deletions src/custom/CatalogDetail/SocialSharePopper.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { Box, IconButton, Menu, MenuItem } from '@mui/material';
import React, { useState } from 'react';
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
import { Typography } from '../../base';
import { ChainIcon, FacebookIcon, LinkedinIcon, ShareIcon, TwitterIcon } from '../../icons';
import { useTheme } from '../../theme';
import { Pattern } from '../CustomCatalog/CustomCard';
import { CustomTooltip } from '../CustomTooltip';
import { ErrorBoundary } from '../ErrorBoundary';
import { ActionButton, CopyShareIconWrapper, VisibilityChip } from './style';
import {
CopyShareIconWrapper,
ShareButton,
ShareButtonGroup,
ShareSideButton,
VisibilityChip
} from './style';

interface SocialSharePopperProps {
details: Pattern;
Expand Down Expand Up @@ -55,12 +62,22 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
</VisibilityChip>

{showShareAction ? (
<CustomTooltip title="Share" placement="top" arrow>
<ActionButton sx={{ borderRadius: '0.2rem', padding: '0.4rem' }} onClick={handleShare}>
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.inverse} />
Share
</ActionButton>
</CustomTooltip>
<ShareButtonGroup variant="contained">
<CustomTooltip title="Change access and visibility">
<ShareButton variant="contained" onClick={handleShare}>
<Typography>Share</Typography>
</ShareButton>
</CustomTooltip>
<CustomTooltip title="Copy link to design">
<ShareSideButton
variant="contained"
size="small"
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
>
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.inverse} />
</ShareSideButton>
</CustomTooltip>
</ShareButtonGroup>
) : (
<>
{details?.visibility !== 'private' && (
Expand Down
23 changes: 22 additions & 1 deletion src/custom/CatalogDetail/style.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, ListItemButton, Paper, Typography } from '../../base';
import { Button, ButtonGroup, Link, ListItemButton, Paper, Typography } from '../../base';
import { styled } from '../../theme';
import { Theme } from './types';

Expand Down Expand Up @@ -265,3 +265,24 @@ export const RedirectLink = styled(Link)(({ theme }) => ({
textDecoration: 'none',
cursor: 'pointer'
}));

export const ShareButtonGroup = styled(ButtonGroup)({
boxShadow: 'none',
border: 'none',
outline: 'none',
height: '76%'
});

export const ShareButton = styled(Button)(({ theme }) => ({
backgroundColor: theme.palette.background.brand?.default,
color: 'white',
border: 'none',
borderRadius: '0.5rem 0px 0px 0.5rem'
}));

export const ShareSideButton = styled(Button)(({ theme }) => ({
backgroundColor: theme.palette.background.brand?.default,
color: 'white',
border: 'none',
borderRadius: '0px 0.5rem 0.5rem 0px'
}));

0 comments on commit c325637

Please sign in to comment.