11import { useLocation } from '@docusaurus/router' ;
22import useBaseUrl from '@docusaurus/useBaseUrl' ;
3+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
34import latestVersions from '@site/static/versions/latestVersions.json' ;
45import { draftDocs } from '../draftDocs' ;
56
@@ -20,6 +21,13 @@ import { draftDocs } from '../draftDocs';
2021 */
2122
2223export const DRAFT_STATUS_TEXT = 'This document is pending final approval by the RMC Director.' ;
24+ // A PR preview shows the draft while it is still in review, before the Director stage.
25+ export const PREVIEW_DRAFT_STATUS_TEXT = 'Draft for review. This document has not been approved for publication.' ;
26+
27+ function useDraftStatusText ( ) {
28+ const { siteConfig } = useDocusaurusContext ( ) ;
29+ return siteConfig . customFields ?. isPreview ? PREVIEW_DRAFT_STATUS_TEXT : DRAFT_STATUS_TEXT ;
30+ }
2331
2432function getDocInfo ( pathname , docsBase ) {
2533 // docsBase is derived from siteConfig.baseUrl, so this resolves under every
@@ -63,12 +71,13 @@ export function useIsDraftDoc() {
6371 */
6472export const DraftStatusStrip = ( ) => {
6573 const isDraft = useIsDraftDoc ( ) ;
74+ const statusText = useDraftStatusText ( ) ;
6675 if ( ! isDraft ) return null ;
6776
6877 return (
6978 < div className = "draft-strip-anchor" >
7079 < div className = "draft-strip" role = "note" aria-label = "Document status" >
71- { DRAFT_STATUS_TEXT }
80+ { statusText }
7281 </ div >
7382 </ div >
7483 ) ;
@@ -84,6 +93,7 @@ export const DraftStatusStrip = () => {
8493 */
8594export const DraftPrintFrame = ( { children } ) => {
8695 const isDraft = useIsDraftDoc ( ) ;
96+ const statusText = useDraftStatusText ( ) ;
8797 if ( ! isDraft ) return < > { children } </ > ;
8898
8999 return (
@@ -92,7 +102,7 @@ export const DraftPrintFrame = ({ children }) => {
92102 < tr >
93103 < td >
94104 < div className = "draft-print-frame__band" aria-hidden = "true" >
95- { DRAFT_STATUS_TEXT }
105+ { statusText }
96106 </ div >
97107 </ td >
98108 </ tr >
@@ -106,7 +116,7 @@ export const DraftPrintFrame = ({ children }) => {
106116 < tr >
107117 < td >
108118 < div className = "draft-print-frame__band draft-print-frame__band--foot" aria-hidden = "true" >
109- { DRAFT_STATUS_TEXT }
119+ { statusText }
110120 </ div >
111121 </ td >
112122 </ tr >
0 commit comments