From 136f4a1b8cecbdc8941ba7fa0d1a83547028bd6c Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 21 Aug 2024 09:45:22 +0200 Subject: [PATCH 1/7] Support versioned code for source links --- .../mui-docs/src/ComponentLinkHeader/ComponentLinkHeader.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-docs/src/ComponentLinkHeader/ComponentLinkHeader.tsx b/packages/mui-docs/src/ComponentLinkHeader/ComponentLinkHeader.tsx index 18ef4ad1ea7777..224690db38440a 100644 --- a/packages/mui-docs/src/ComponentLinkHeader/ComponentLinkHeader.tsx +++ b/packages/mui-docs/src/ComponentLinkHeader/ComponentLinkHeader.tsx @@ -107,7 +107,7 @@ export function ComponentLinkHeader(props: ComponentLinkHeaderProps) { size="small" variant="outlined" rel="nofollow" - href={`${process.env.SOURCE_CODE_REPO}/tree/${process.env.SOURCE_GITHUB_BRANCH}/${headers.githubSource}`} + href={`${process.env.SOURCE_CODE_REPO}/blob/v${process.env.LIB_VERSION}/${headers.githubSource}`} icon={} data-ga-event-category="ComponentLinkHeader" data-ga-event-action="click" From 04ad61e7b4b6c2e8a917489c3d052a66c3052dcb Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 21 Aug 2024 10:04:58 +0200 Subject: [PATCH 2/7] Add link in API page --- docs/src/modules/components/ApiPage.tsx | 17 +++++++++++++++++ .../mui-docs/src/translations/translations.json | 1 + 2 files changed, 18 insertions(+) diff --git a/docs/src/modules/components/ApiPage.tsx b/docs/src/modules/components/ApiPage.tsx index d3aab5ed9d85ba..393158d5d0ed2e 100644 --- a/docs/src/modules/components/ApiPage.tsx +++ b/docs/src/modules/components/ApiPage.tsx @@ -360,6 +360,23 @@ export default function ApiPage(props: ApiPageProps) { layoutStorageKey={layoutStorageKey.classes} displayClassKeys /> + + {pageContent.filename ? ( +
+ ) : null} diff --git a/packages/mui-docs/src/translations/translations.json b/packages/mui-docs/src/translations/translations.json index 5c4dfc2a14b24a..f9d3c6be685e2d 100644 --- a/packages/mui-docs/src/translations/translations.json +++ b/packages/mui-docs/src/translations/translations.json @@ -45,6 +45,7 @@ "refNotHeld": "The component cannot hold a ref.", "refRootElement": "The ref is forwarded to the root element.", "ruleName": "Rule name", + "seeSourceCode": "If you did not find the information in this AOI page, consider having a look at the implementation of the component for more detail.", "signature": "Signature", "slots": "Slots", "spreadHint": "Props of the {{spreadHintElement}} component are also available.", From 3e9de7bab79b7fcd262a3ddb6e8ffbc16dbc957f Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 21 Aug 2024 10:11:05 +0200 Subject: [PATCH 3/7] fixes --- docs/src/modules/components/ApiPage.tsx | 17 ++++++++++------- .../mui-docs/src/translations/translations.json | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/src/modules/components/ApiPage.tsx b/docs/src/modules/components/ApiPage.tsx index 393158d5d0ed2e..d4799ec6ea5ea7 100644 --- a/docs/src/modules/components/ApiPage.tsx +++ b/docs/src/modules/components/ApiPage.tsx @@ -364,18 +364,21 @@ export default function ApiPage(props: ApiPageProps) { {pageContent.filename ? (
+ > +

+

) : null} diff --git a/packages/mui-docs/src/translations/translations.json b/packages/mui-docs/src/translations/translations.json index f9d3c6be685e2d..a8aa06bf5f2568 100644 --- a/packages/mui-docs/src/translations/translations.json +++ b/packages/mui-docs/src/translations/translations.json @@ -45,7 +45,7 @@ "refNotHeld": "The component cannot hold a ref.", "refRootElement": "The ref is forwarded to the root element.", "ruleName": "Rule name", - "seeSourceCode": "If you did not find the information in this AOI page, consider having a look at the implementation of the component for more detail.", + "seeSourceCode": "If you did not find the information in this page, consider having a look at the implementation of the component for more detail.", "signature": "Signature", "slots": "Slots", "spreadHint": "Props of the {{spreadHintElement}} component are also available.", From 4e61a09dd13682fd1bdf1955def45d9c614a56e5 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 24 Aug 2024 21:41:05 +0200 Subject: [PATCH 4/7] feedback --- docs/src/modules/components/ApiPage.tsx | 19 ++++++++----------- .../src/translations/translations.json | 1 + 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/src/modules/components/ApiPage.tsx b/docs/src/modules/components/ApiPage.tsx index d4799ec6ea5ea7..96d6ff5ce36ea4 100644 --- a/docs/src/modules/components/ApiPage.tsx +++ b/docs/src/modules/components/ApiPage.tsx @@ -47,7 +47,8 @@ type ApiHeaderKeys = | 'inheritance' | 'slots' | 'classes' - | 'css'; + | 'css' + | 'source-code'; export function getTranslatedHeader(t: Translate, header: ApiHeaderKeys) { const translations = { @@ -59,6 +60,7 @@ export function getTranslatedHeader(t: Translate, header: ApiHeaderKeys) { slots: t('api-docs.slots'), classes: t('api-docs.classes'), css: t('api-docs.css'), + 'source-code': t('api-docs.source-code'), }; // TODO Drop runtime type-checking once we type-check this file @@ -202,7 +204,8 @@ export default function ApiPage(props: ApiPageProps) { getPropertiesToC({ properties: propertiesDef, hash: 'props', t }), ...(componentSlots?.length > 0 ? [createTocEntry('slots')] : []), ...getClassesToC({ classes: classesDef, t }), - ].filter(Boolean); + pageContent.filename ? createTocEntry('source-code') : null, + ].filter((item): item is TableOfContentsParams => Boolean(item)); // The `ref` is forwarded to the root element. let refHint = t('api-docs.refRootElement'); @@ -362,14 +365,8 @@ export default function ApiPage(props: ApiPageProps) { /> {pageContent.filename ? ( -
+ +

-

+ ) : null} diff --git a/packages/mui-docs/src/translations/translations.json b/packages/mui-docs/src/translations/translations.json index a8aa06bf5f2568..b12d0d96fdaf77 100644 --- a/packages/mui-docs/src/translations/translations.json +++ b/packages/mui-docs/src/translations/translations.json @@ -53,6 +53,7 @@ "styleOverrides": "The name {{componentStyles.name}} can be used when providing default props or style overrides in the theme.", "slotDescription": "To learn how to customize the slot, check out the Overriding component structure guide.", "slotName": "Slot name", + "source-code": "Source code", "type": "Type", "required": "Required", "optional": "Optional", From 7dbb82c5a1277cb31d7199150b399c4e4d2318ce Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 26 Aug 2024 09:14:29 +0200 Subject: [PATCH 5/7] make it fail --- docs/src/modules/components/ApiPage.tsx | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/docs/src/modules/components/ApiPage.tsx b/docs/src/modules/components/ApiPage.tsx index 96d6ff5ce36ea4..19ec201baa713d 100644 --- a/docs/src/modules/components/ApiPage.tsx +++ b/docs/src/modules/components/ApiPage.tsx @@ -364,19 +364,15 @@ export default function ApiPage(props: ApiPageProps) { displayClassKeys /> - {pageContent.filename ? ( - - -

- - ) : null} + +

From 38b7b864e320c5ad431cee7e4c419da3f228a7e7 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 26 Aug 2024 09:34:21 +0200 Subject: [PATCH 6/7] fix-checkout --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d65a5f1a0dcba3..e4c859c29b1d40 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25227,4 +25227,4 @@ snapshots: optionalDependencies: react: 18.3.1 - zwitch@1.0.5: {} + zwitch@1.0.5: {} \ No newline at end of file From 926c6ccf0ad73929e92b1dd14b9081238eb9a7fe Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 26 Aug 2024 09:35:05 +0200 Subject: [PATCH 7/7] dedupe --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e4c859c29b1d40..d65a5f1a0dcba3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25227,4 +25227,4 @@ snapshots: optionalDependencies: react: 18.3.1 - zwitch@1.0.5: {} \ No newline at end of file + zwitch@1.0.5: {}