Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-infra] Improve callouts design #39084

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/pages/experiments/docs/callouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## Info

:::info
One-liner info callout.
:::

:::info
This is an info callout.
It says, "Here's a bit of extra insight to help you understand this feature."
Expand All @@ -27,6 +31,10 @@ It says, "Here's a bit of extra insight to help you understand this feature."

## Success

:::success
One-liner success callout.
:::

:::success
This is a success callout.
It says, "Here's an actionable suggestion to help you succeed."
Expand All @@ -50,6 +58,10 @@ It says, "Here's an actionable suggestion to help you succeed."

## Warning

:::warning
One-liner warning callout.
:::

:::warning
This is a warning callout.
It says, "Be careful! Keep this detail in mind to avoid potential issues."
Expand All @@ -73,6 +85,10 @@ It says, "Be careful! Keep this detail in mind to avoid potential issues."

## Error

:::error
One-liner error callout.
:::

:::error
This is an error callout.
It says, "You will fail if you don't heed this dire warning."
Expand Down
3 changes: 2 additions & 1 deletion docs/src/modules/components/ApiPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,11 @@ export default function ApiPage(props) {
className="MuiCallout-root MuiCallout-info"
dangerouslySetInnerHTML={{ __html: refHint }}
/>
<Divider />
{inheritance && (
<React.Fragment>
<Heading hash="inheritance" level="h3" />
<span
<p
dangerouslySetInnerHTML={{
__html: t('api-docs.inheritanceDescription')
.replace(/{{component}}/, inheritance.component)
Expand Down
24 changes: 13 additions & 11 deletions docs/src/modules/components/ApiPage/ApiItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,19 @@ const Root = styled('div')<{ ownerState: { type?: DescriptionType } }>(
},
},
'& .MuiAlert-standardWarning': {
padding: '6px 12px',
fontWeight: theme.typography.fontWeightMedium,
display: 'flex',
alignItems: 'baseline',
fontSize: theme.typography.pxToRem(16),
padding: '6px 16px',
border: '1px solid',
borderColor: `var(--muidocs-palette-warning-300, ${lightTheme.palette.warning[300]})`,
borderRadius: 8,
backgroundColor: `var(--muidocs-palette-warning-50, ${lightTheme.palette.warning[50]})`,
color: `var(--muidocs-palette-warning-800, ${lightTheme.palette.warning[800]})`,
color: `var(--muidocs-palette-grey-900, ${lightTheme.palette.grey[900]})`,
backgroundColor: alpha(lightTheme.palette.warning[50], 0.5),
borderColor: `var(--muidocs-palette-warning-200, ${lightTheme.palette.warning[200]})`,
borderRadius: `var(--muidocs-shape-borderRadius, ${
theme.shape?.borderRadius ?? lightTheme.shape.borderRadius
}px)`,
marginBottom: 16,
'.MuiAlert-icon': {
display: 'flex',
alignItems: 'center',
fill: `var(--muidocs-palette-warning-800, ${lightTheme.palette.warning[800]})`,
},
},
Expand Down Expand Up @@ -172,9 +174,9 @@ const Root = styled('div')<{ ownerState: { type?: DescriptionType } }>(
},
},
'& .MuiAlert-standardWarning': {
borderColor: alpha(darkTheme.palette.warning[800], 0.3),
backgroundColor: alpha(darkTheme.palette.warning[800], 0.2),
color: `var(--muidocs-palette-warning-100, ${darkTheme.palette.warning[100]})`,
color: `var(--muidocs-palette-warning-50, ${darkTheme.palette.warning[50]})`,
backgroundColor: alpha(darkTheme.palette.warning[700], 0.15),
borderColor: alpha(darkTheme.palette.warning[600], 0.3),
'.MuiAlert-icon svg': {
fill: `var(--muidocs-palette-warning-400, ${darkTheme.palette.warning[400]})`,
},
Expand Down
10 changes: 10 additions & 0 deletions docs/src/modules/components/MarkdownElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ const Root = styled('div')(
borderRadius: `var(--muidocs-shape-borderRadius, ${
theme.shape?.borderRadius ?? lightTheme.shape.borderRadius
}px)`,
'&>code': {
height: 'fit-content',
backgroundColor: `var(--muidocs-palette-grey-100, ${lightTheme.palette.grey[100]})`,
borderColor: `var(--muidocs-palette-grey-300, ${lightTheme.palette.grey[300]})`,
},
'& .MuiCallout-content': {
minWidth: 0, // Allows content to shrink. Useful when callout contains code block
flexGrow: 1,
Expand Down Expand Up @@ -610,6 +615,11 @@ const Root = styled('div')(
},
'& .MuiCallout-root': {
borderColor: `var(--muidocs-palette-primaryDark-700, ${darkTheme.palette.primaryDark[700]})`,
'&>code': {
height: 'fit-content',
backgroundColor: `var(--muidocs-palette-primaryDark-600, ${lightTheme.palette.primaryDark[600]})`,
borderColor: `var(--muidocs-palette-primaryDark-500, ${lightTheme.palette.primaryDark[500]})`,
},
'&.MuiCallout-error': {
color: `var(--muidocs-palette-error-50, ${darkTheme.palette.error[50]})`,
backgroundColor: alpha(darkTheme.palette.error[700], 0.2),
Expand Down