Skip to content

Commit

Permalink
remove copy button from the Demo Toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-leal committed May 3, 2024
1 parent 24a604e commit 52ce12c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
3 changes: 0 additions & 3 deletions docs/src/modules/components/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,6 @@ const DemoCodeViewer = styled(HighlightedCode)(() => ({
borderBottomLeftRadius: 12,
borderBottomRightRadius: 12,
},
'& .MuiCode-copy': {
display: 'none',
},
}));

const AnchorLink = styled('div')({
Expand Down
3 changes: 0 additions & 3 deletions docs/src/modules/components/DemoEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ const StyledMarkdownElement = styled(MarkdownElement)(({ theme }) => [
maxWidth: 'initial',
maxHeight: 'initial',
},
'& .MuiCode-copy': {
display: 'none',
},
},
]) as any;

Expand Down
29 changes: 3 additions & 26 deletions docs/src/modules/components/DemoToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Tooltip from '@mui/material/Tooltip';
import Divider from '@mui/material/Divider';
import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded';
import ResetFocusIcon from '@mui/icons-material/CenterFocusWeak';
import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded';
import { useRouter } from 'next/router';
import { CODE_VARIANTS, CODE_STYLING } from 'docs/src/modules/constants';
import { useSetCodeVariant } from 'docs/src/modules/utils/codeVariant';
Expand Down Expand Up @@ -339,16 +338,6 @@ export default function DemoToolbar(props) {
setSnackbarOpen(false);
};

const handleCopyClick = async () => {
try {
await copyWithRelativeModules(demoData.raw, demoData.relativeModules);
setSnackbarMessage(t('copiedSource'));
setSnackbarOpen(true);
} finally {
handleMoreClose();
}
};

const createHandleCodeSourceLink = (anchor, codeVariantParam, stylingSolution) => async () => {
try {
await copy(
Expand Down Expand Up @@ -586,25 +575,13 @@ export default function DemoToolbar(props) {
</DemoTooltip>
</React.Fragment>
)}
<DemoTooltip title={t('copySource')} placement="bottom">
<IconButton
data-ga-event-category="demo"
data-ga-event-label={demo.gaLabel}
data-ga-event-action="copy"
onClick={handleCopyClick}
{...getControlProps(6)}
sx={{ borderRadius: 1 }}
>
<ContentCopyRoundedIcon />
</IconButton>
</DemoTooltip>
<DemoTooltip title={t('resetFocus')} placement="bottom">
<IconButton
data-ga-event-category="demo"
data-ga-event-label={demo.gaLabel}
data-ga-event-action="reset-focus"
onClick={handleResetFocusClick}
{...getControlProps(7)}
{...getControlProps(6)}
sx={{ borderRadius: 1 }}
>
<ResetFocusIcon />
Expand All @@ -617,7 +594,7 @@ export default function DemoToolbar(props) {
data-ga-event-label={demo.gaLabel}
data-ga-event-action="reset"
onClick={onResetDemoClick}
{...getControlProps(8)}
{...getControlProps(7)}
sx={{ borderRadius: 1 }}
>
<RefreshRoundedIcon />
Expand All @@ -628,7 +605,7 @@ export default function DemoToolbar(props) {
aria-label={t('seeMore')}
aria-owns={anchorEl ? 'demo-menu-more' : undefined}
aria-haspopup="true"
{...getControlProps(9)}
{...getControlProps(8)}
sx={{ borderRadius: 1 }}
>
<MoreVertIcon />
Expand Down

0 comments on commit 52ce12c

Please sign in to comment.