diff --git a/packages/markdown/parseMarkdown.js b/packages/markdown/parseMarkdown.js index 874f48b1241582..3516a7aa1262c2 100644 --- a/packages/markdown/parseMarkdown.js +++ b/packages/markdown/parseMarkdown.js @@ -423,10 +423,8 @@ function createRender(context) { escaped ? code : escape(code, true) }${[ '', ].join('')}\n`; }; diff --git a/packages/mui-docs/src/CodeCopy/CodeCopyButton.tsx b/packages/mui-docs/src/CodeCopy/CodeCopyButton.tsx index 648e479a504399..4b90ca5e71b1d3 100644 --- a/packages/mui-docs/src/CodeCopy/CodeCopyButton.tsx +++ b/packages/mui-docs/src/CodeCopy/CodeCopyButton.tsx @@ -1,6 +1,4 @@ import * as React from 'react'; -import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded'; -import LibraryAddCheckRoundedIcon from '@mui/icons-material/LibraryAddCheckRounded'; import useClipboardCopy from './useClipboardCopy'; export interface CodeCopyButtonProps { @@ -27,12 +25,8 @@ export function CodeCopyButton(props: CodeCopyButtonProps) { }} > {/* material-ui/no-hardcoded-labels */} - {isCopied ? ( - - ) : ( - - )} - + {isCopied ? 'Copied' : 'Copy'} + (or {key}C) diff --git a/packages/mui-docs/src/MarkdownElement/MarkdownElement.tsx b/packages/mui-docs/src/MarkdownElement/MarkdownElement.tsx index b95280444c9c0a..3b1bcdbd0cea6f 100644 --- a/packages/mui-docs/src/MarkdownElement/MarkdownElement.tsx +++ b/packages/mui-docs/src/MarkdownElement/MarkdownElement.tsx @@ -532,44 +532,34 @@ const Root = styled('div')( top: 0, }, '& .MuiCode-copy': { - display: 'inline-flex', - flexDirection: 'row-reverse', - alignItems: 'center', - width: 26, - height: 26, cursor: 'pointer', position: 'absolute', top: 12, right: 12, + display: 'inline-flex', + flexDirection: 'row-reverse', + alignItems: 'center', + height: 24, padding: theme.spacing(0.5), - fontFamily: 'inherit', - fontWeight: 500, + paddingBottom: '5px', // optical alignment + fontFamily: lightTheme.typography.fontFamily, + fontWeight: lightTheme.typography.fontWeightMedium, + fontSize: lightTheme.typography.pxToRem(12), borderRadius: 6, - border: 'none', - backgroundColor: 'hsl(210, 35%, 9%)', // using the code block one-off background color (defined in line 23) - color: '#FFF', + border: '1px solid', + borderColor: alpha(lightTheme.palette.primaryDark[600], 0.5), + backgroundColor: alpha(lightTheme.palette.primaryDark[800], 0.5), + color: `var(--muidocs-palette-grey-200, ${lightTheme.palette.grey[200]})`, transition: theme.transitions.create(['background', 'borderColor', 'display'], { duration: theme.transitions.duration.shortest, }), - '& svg': { - userSelect: 'none', - width: theme.typography.pxToRem(16), - height: theme.typography.pxToRem(16), - display: 'inline-block', - fill: 'currentcolor', - flexShrink: 0, - fontSize: '18px', - margin: 'auto', - opacity: 0.5, - }, - '& .MuiCode-copied-icon': { + '& .MuiCode-copied-label': { display: 'none', }, '&:hover, &:focus': { - backgroundColor: lightTheme.palette.primaryDark[600], - '& svg': { - opacity: 1, - }, + borderColor: `var(--muidocs-palette-primaryDark-400, ${lightTheme.palette.primaryDark[400]})`, + backgroundColor: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`, + color: '#FFF', '& .MuiCode-copyKeypress': { display: 'block', // Approximate no hover capabilities with no keyboard @@ -582,17 +572,19 @@ const Root = styled('div')( '& .MuiCode-copyKeypress': { display: 'none', position: 'absolute', - right: 26, + right: 34, }, '&[data-copied]': { - // style of the button when it is in copied state. - borderColor: lightTheme.palette.primary[700], + borderColor: `var(--muidocs-palette-primaryDark-400, ${lightTheme.palette.primaryDark[400]})`, + backgroundColor: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`, color: '#fff', - backgroundColor: lightTheme.palette.primaryDark[600], - '& .MuiCode-copy-icon': { + '& .MuiCode-copyKeypress': { + opacity: 0, + }, + '& .MuiCode-copy-label': { display: 'none', }, - '& .MuiCode-copied-icon': { + '& .MuiCode-copied-label': { display: 'block', }, },