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] Bring back scroll gradient in API page with table #39689

Merged
merged 6 commits into from
Nov 1, 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
3 changes: 3 additions & 0 deletions docs/src/modules/brandingTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,9 @@ export function getThemedComponents(): ThemeOptions {
color: (theme.vars || theme).palette.primary[500],
borderColor: `${(theme.vars || theme).palette.primary[500]} !important`,
backgroundColor: (theme.vars || theme).palette.primary[50],
'&:hover': {
backgroundColor: (theme.vars || theme).palette.primary[100],
},
},
} as const,
theme.applyDarkStyles({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ const Root = styled('div')<{ ownerState: { type?: DescriptionType } }>(
...theme.typography.caption,
fontFamily: theme.typography.fontFamilyCode,
fontWeight: theme.typography.fontWeightRegular,
color: `var(--muidocs-palette-text-primary, ${lightTheme.palette.text.primary})`,
padding: '1px 4px',
borderRadius: 6,
border: '1px solid',
borderColor: alpha(darkTheme.palette.primary[100], 0.5),
borderColor: alpha(darkTheme.palette.primary[100], 0.8),
backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.primary[50]})`,
},
}),
Expand Down
103 changes: 44 additions & 59 deletions docs/src/modules/components/ApiPage/table/CSSTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,26 @@ import {
brandingLightTheme as lightTheme,
} from 'docs/src/modules/brandingTheme';
import { CSSFormatedParams, getHash } from 'docs/src/modules/components/ApiPage/list/CSSList';
import StyledTableContainer from './StyledTableContainer';

const StyledTable = styled('table')(
({ theme }) => ({
'& .table-headers': {
paddingTop: 8,
paddingBottom: 8,
textAlign: 'left',
fontWeight: theme.typography.fontWeightSemiBold,
fontSize: theme.typography.pxToRem(14),
},
'& tr': {
scrollMarginTop: 'calc(var(--MuiDocs-header-height) + 32px)',
'&:hover': {
backgroundColor: alpha(darkTheme.palette.grey[50], 0.5),
},
},
'& .MuiApi-table-rule-name': {
fontFamily: theme.typography.fontFamilyCode,
fontWeight: theme.typography.fontWeightSemiBold,
fontSize: theme.typography.pxToRem(13),
color: `var(--muidocs-palette-primary-600, ${lightTheme.palette.primary[600]})`,
},
'& .MuiApi-table-ruleName': {
padding: '0 4px',
borderRadius: 5,
border: '1px solid',
borderColor: alpha(darkTheme.palette.primary[100], 0.5),
backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.primary[50]})`,
...theme.typography.caption,
fontFamily: theme.typography.fontFamilyCode,
fontWeight: theme.typography.fontWeightRegular,
color: `var(--muidocs-palette-text-primary, ${lightTheme.palette.text.primary})`,
padding: '1px 4px',
borderRadius: 6,
border: '1px solid',
borderColor: alpha(darkTheme.palette.primary[100], 0.8),
backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.primary[50]})`,
},
'& .MuiApi-table-global-class': {
fontWeight: theme.typography.fontWeightSemiBold,
Expand All @@ -52,11 +40,6 @@ const StyledTable = styled('table')(
}),
({ theme }) => ({
[`:where(${theme.vars ? '[data-mui-color-scheme="dark"]' : '.mode-dark'}) &`]: {
'& tr': {
'&:hover': {
backgroundColor: alpha(darkTheme.palette.primaryDark[800], 0.5),
},
},
'& .MuiApi-table-ruleName': {
color: `var(--muidocs-palette-text-primary, ${darkTheme.palette.text.primary})`,
borderColor: alpha(darkTheme.palette.primary[400], 0.1),
Expand All @@ -76,46 +59,48 @@ interface CSSTableProps {
export default function CSSTable(props: CSSTableProps) {
const { classes } = props;
return (
<StyledTable>
<thead>
<tr>
<th className="table-headers">Global class</th>
<th className="table-headers">Rule name</th>
<th className="table-headers">Description</th>
</tr>
</thead>
<tbody>
{classes.map((params) => {
const { componentName, className, selector, description } = params;
<StyledTableContainer>
<StyledTable>
<thead>
<tr>
<th>Global class</th>
<th>Rule name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{classes.map((params) => {
const { componentName, className, selector, description } = params;

return (
<tr key={className} id={getHash({ componentName, className })}>
<td>
{
return (
<tr key={className} id={getHash({ componentName, className })}>
<td>
{
<span
className="MuiApi-table-global-class"
dangerouslySetInnerHTML={{
__html: selector || '',
}}
/>
}
</td>
<td>
<span className="MuiApi-table-ruleName">{className}</span>
</td>

<td className="MuiCssTable-description-column">
<span
className="MuiApi-table-global-class"
className="MuiApi-table-description"
dangerouslySetInnerHTML={{
__html: selector || '',
__html: description || '',
}}
/>
}
</td>
<td>
<span className="MuiApi-table-ruleName">{className}</span>
</td>

<td className="MuiCssTable-description-column">
<span
className="MuiApi-table-description"
dangerouslySetInnerHTML={{
__html: description || '',
}}
/>
</td>
</tr>
);
})}
</tbody>
</StyledTable>
</td>
</tr>
);
})}
</tbody>
</StyledTable>
</StyledTableContainer>
);
}
24 changes: 3 additions & 21 deletions docs/src/modules/components/ApiPage/table/ClassesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-danger */
import * as React from 'react';
import { styled, alpha } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import {
brandingDarkTheme as darkTheme,
brandingLightTheme as lightTheme,
Expand All @@ -12,19 +12,6 @@ import {

const StyledTable = styled('table')(
({ theme }) => ({
'& .table-headers': {
paddingTop: 8,
paddingBottom: 8,
textAlign: 'left',
fontWeight: theme.typography.fontWeightSemiBold,
fontSize: theme.typography.pxToRem(14),
},
'& tr': {
scrollMarginTop: 'calc(var(--MuiDocs-header-height) + 32px)',
'&:hover': {
backgroundColor: alpha(darkTheme.palette.grey[50], 0.5),
},
},
'& .rule-name': {
flexShrink: 0,
fontWeight: theme.typography.fontWeightSemiBold,
Expand All @@ -35,11 +22,6 @@ const StyledTable = styled('table')(
}),
({ theme }) => ({
[`:where(${theme.vars ? '[data-mui-color-scheme="dark"]' : '.mode-dark'}) &`]: {
'& tr': {
'&:hover': {
backgroundColor: alpha(darkTheme.palette.primaryDark[800], 0.5),
},
},
'& .rule-name': {
color: `var(--muidocs-palette-primary-200, ${darkTheme.palette.primary[200]})`,
},
Expand All @@ -57,8 +39,8 @@ export default function ClassesTable(props: ClassesTableProps) {
<StyledTable>
<thead>
<tr>
<th className="table-headers">Rule name</th>
<th className="table-headers">Description</th>
<th>Rule name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
Expand Down
Loading
Loading