-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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] Move API pages to TS #43199
Conversation
Netlify deploy previewhttps://deploy-preview-43199--material-ui.netlify.app/ Bundle size report |
displayClassKeys?: boolean; | ||
styleOverridesLink?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more you type pages, the more you fix inconsistencies 😅
function Heading(props: SectionTitleProps) { | ||
const { hash, title, level = 'h2' } = props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed this props title
to match with the SectionTitle
props naming
@@ -80,7 +96,7 @@ export default function HooksApiContent(props) { | |||
title="api-docs.parameters" | |||
titleHash={`${hookNameKebabCase}-parameters`} | |||
defaultLayout={defaultLayout} | |||
layoutStorageKey={layoutStorageKey} | |||
layoutStorageKey={layoutStorageKey.props} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS helping to spot wrong usage of component props 👮♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Glad typing pays off
@@ -30,7 +30,7 @@ import { | |||
getClassApiDefinitions, | |||
getClassesToC, | |||
} from 'docs/src/modules/components/ApiPage/definitions/classes'; | |||
import { getSlotsApiDefinitions } from './ApiPage/definitions/slots'; | |||
import { getSlotsApiDefinitions } from 'docs/src/modules/components/ApiPage/definitions/slots'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relative imports make more sense imo, but that's a little pet peeve of mine 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a post traumatic symptomes.
Did not took care of it so I've little context, but most of the files on docs/modules
don't have a relative import because it was causing conflict when used in mui-x repo. Since mui-x and material-ui agree on the fact the docs/
point to this folder (in mui-x the docs
folder is aliased docsx
), every import start with docs/
This is a follow up of #43128
In this PR I move all the component reusing API Sections to TS, which implies:
Typing there title component
TS was wonplaining about proptypes being
any
so I did the following to at least keep the warnings in dev modeI also moved the
ComponentClassDefinition
type to the@mui-internal/api-docs-builder
for consistency with the other types (for pros, slots)