From d313196ba7ac8ab5535a2d188ffd5d8929771ae8 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:33:23 -0300 Subject: [PATCH] attempt at adding the code path header --- .../installation/installation.md | 4 +++ docs/pages/experiments/docs/codeblock.md | 22 ++++++++++++++++ .../src/modules/components/MarkdownElement.js | 25 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/docs/data/material/getting-started/installation/installation.md b/docs/data/material/getting-started/installation/installation.md index ffcc22d222f0dc..8f697684551b4a 100644 --- a/docs/data/material/getting-started/installation/installation.md +++ b/docs/data/material/getting-started/installation/installation.md @@ -8,6 +8,10 @@ Run one of the following commands to add MaterialĀ UI to your project: +
+title +
+ ```bash npm npm install @mui/material @emotion/react @emotion/styled ``` diff --git a/docs/pages/experiments/docs/codeblock.md b/docs/pages/experiments/docs/codeblock.md index 4ee6cefb023b9b..0b398135ce0eb9 100644 --- a/docs/pages/experiments/docs/codeblock.md +++ b/docs/pages/experiments/docs/codeblock.md @@ -42,3 +42,25 @@ npm install @mui/data-grid-premium ## Component {{"component": "modules/components/HighlightedCodeWithTabs", "tabs": [{"tab":"JS", "code":"
Hello
", "language": "jsx"}, {"tab": "TS", "code": "type A = {}"}]}} + +## With header path + +
+

PlainCssSliderDeep1.js

+ +```jsx +import * as React from 'react'; +import Slider from '@mui/material/Slider'; +import './PlainCssSliderDeep1.css'; + +export default function PlainCssSliderDeep1() { + return ( +
+ + +
+ ); +} +``` + +
diff --git a/docs/src/modules/components/MarkdownElement.js b/docs/src/modules/components/MarkdownElement.js index 24f18dd51a749b..e3185165cf30c1 100644 --- a/docs/src/modules/components/MarkdownElement.js +++ b/docs/src/modules/components/MarkdownElement.js @@ -601,6 +601,31 @@ const Root = styled('div')( marginBottom: theme.spacing(1), }, }, + '& .codeblock-with-header': { + border: `1px solid var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`, + borderRadius: theme.shape.borderRadius, + overflow: 'clip', + ' pre': { margin: 0, border: 'none', borderRadius: 0 }, + '& .header': { + margin: 0, + padding: theme.spacing(1.5), + display: 'flex', + alignItems: 'center', + gap: theme.spacing(1), + borderBottom: `1px solid var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`, + borderColor: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`, + backgroundColor: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[900]})`, + fontSize: theme.typography.pxToRem(14), + fontWeight: lightTheme.typography.fontWeightMedium, + color: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.grey[200]})`, + '::before': { + content: `url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.3333 3.99996H8L7.06 3.05996C6.80667 2.80663 6.46667 2.66663 6.11334 2.66663H2.66667C1.93334 2.66663 1.34 3.26663 1.34 3.99996L1.33334 12C1.33334 12.7333 1.93334 13.3333 2.66667 13.3333H13.3333C14.0667 13.3333 14.6667 12.7333 14.6667 12V5.33329C14.6667 4.59996 14.0667 3.99996 13.3333 3.99996ZM12.6667 12H3.33334C2.96667 12 2.66667 11.7 2.66667 11.3333V5.99996C2.66667 5.63329 2.96667 5.33329 3.33334 5.33329H12.6667C13.0333 5.33329 13.3333 5.63329 13.3333 5.99996V11.3333C13.3333 11.7 13.0333 12 12.6667 12Z' fill='%2399CCF3'/%3E%3C/svg%3E%0A");`, + width: '18px', + height: '18px', + marginTop: '2px', // for optical alignment + }, + }, + }, }), ({ theme }) => ({ [`:where(${theme.vars ? '[data-mui-color-scheme="dark"]' : '.mode-dark'}) &`]: {