Skip to content
Merged
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
38 changes: 20 additions & 18 deletions docs/src/modules/components/ApiPage/list/ExpandableApiItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ const Root = styled('div')<{ ownerState: { type?: DescriptionType } }>(
({ theme }) => ({
position: 'relative',
marginBottom: 12,
scrollMarginTop: 'calc(var(--MuiDocs-header-height) + 32px)',
'& .MuiApi-item-header': {
minHeight: 26,
display: 'flex',
alignItems: 'center',
marginLeft: -38,
marginBottom: 8,
marginLeft: -38,
lineHeight: 1.5,
},
'& .MuiApi-item-header-link': {
minHeight: 26,
display: 'flex',
alignItems: 'center',
scrollMarginTop: 'calc(var(--MuiDocs-header-height) + 32px)',
},
'& .MuiApi-item-link-visual': {
display: 'none',
flexShrink: 0,
Expand Down Expand Up @@ -179,30 +183,28 @@ export default function ExpandableApiItem(props: ExpandableApiItemProps) {
setIsExtended(displayOption === 'expanded');
}, [displayOption]);

const anchorLabelId = React.useId();

return (
<Root
ownerState={{ type }}
{...other}
id={id}
className={clsx(
`MuiApi-item-root ${isExtendable ? 'MuiApi-item-header-extendable' : ''}`,
`MuiApi-item-root${isExtendable ? ' MuiApi-item-header-extendable' : ''}`,
className,
)}
>
<div className="MuiApi-item-header">
<a className="MuiApi-item-link-visual" href={`#${id}`} aria-labelledby={anchorLabelId}>
<svg>
<use xlinkHref="#anchor-link-icon" />
</svg>
</a>
<span
id={anchorLabelId}
className="MuiApi-item-title algolia-lvl3" // This className is used by Algolia
>
{title}
</span>
<div className="MuiApi-item-header-link" id={id}>
<a className="MuiApi-item-link-visual" href={`#${id}`} aria-labelledby={id}>
<svg>
<use xlinkHref="#anchor-link-icon" />
</svg>
</a>
<span
className="MuiApi-item-title algolia-lvl3" // This className is used by Algolia
>
{title}
</span>
</div>
{note && <span className="MuiApi-item-note">{note}</span>}
{isExtendable && (
<IconButton
Expand Down