File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 text-align : center;
66 padding : 0.5rem 1rem ;
77 font-size : 0.875rem ;
8- position : fixed;
9- bottom : 0 ;
10- left : 0 ;
11- right : 0 ;
12- z-index : 1000 ;
138}
149
1510.pre-release-banner strong {
1611 font-weight : 600 ;
1712}
1813
14+ /* Old Version Banner */
15+ .old-version-banner {
16+ display : flex;
17+ flex-wrap : wrap;
18+ align-items : center;
19+ justify-content : center;
20+ gap : 0.25rem 0.5rem ;
21+ padding : 0.5rem 1rem ;
22+ background : linear-gradient (90deg , var (--rp-c-brand-darker ) 0% , var (--rp-c-brand ) 100% );
23+ color : # ffffff ;
24+ font-size : 0.875rem ;
25+ text-align : center;
26+ }
27+
28+ .old-version-banner strong {
29+ font-weight : 600 ;
30+ }
31+
32+ .old-version-banner-link {
33+ color : # ffffff !important ;
34+ font-weight : 500 ;
35+ white-space : nowrap;
36+ text-decoration : underline;
37+ text-underline-offset : 2px ;
38+ }
39+
40+ .old-version-banner-link : hover {
41+ color : # ffffff !important ;
42+ opacity : 0.85 ;
43+ }
44+
1945: root {
2046 --rp-nav-height : 60px !important ;
2147 --rp-sidebar-width : 320px !important ;
Original file line number Diff line number Diff line change @@ -438,5 +438,4 @@ export default defineConfig({
438438 // @ts -expect-error
439439 pluginVercelAnalytics ( ) ,
440440 ] ,
441- globalUIComponents : [ path . join ( __dirname , 'theme/PreReleaseBanner.tsx' ) ] ,
442441} ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { useLocation } from '@rspress/core/runtime' ;
2+ import { Link , Layout as RspressLayout } from '@rspress/core/theme-original' ;
3+
4+ const LATEST_VERSION = '13.x' ;
5+
6+ const PreReleaseBanner = ( ) => (
7+ < div className = "pre-release-banner" >
8+ < span >
9+ You are viewing documentation for < strong > v14 alpha</ strong > . This version is under active
10+ development and APIs may change.
11+ </ span >
12+ </ div >
13+ ) ;
14+
15+ const OldVersionBanner = ( { version } : { version : string } ) => (
16+ < div className = "old-version-banner" >
17+ < span >
18+ You're viewing the documentation for < strong > { version } </ strong > . Current latest version is{ ' ' }
19+ < strong > { LATEST_VERSION } </ strong > .
20+ </ span >
21+ < Link href = "/react-native-testing-library/docs/start/intro" className = "old-version-banner-link" >
22+ View latest version < strong > here</ strong > .
23+ </ Link >
24+ </ div >
25+ ) ;
26+
27+ const AnnouncementBanner = ( ) => {
28+ const { pathname } = useLocation ( ) ;
29+
30+ if ( pathname . includes ( '/14.x/' ) ) {
31+ return < PreReleaseBanner /> ;
32+ }
33+
34+ if ( pathname . includes ( '/12.x/' ) ) {
35+ return < OldVersionBanner version = "12.x" /> ;
36+ }
37+
38+ return null ;
39+ } ;
40+
41+ const Layout = ( ) => < RspressLayout beforeNav = { < AnnouncementBanner /> } /> ;
42+
43+ export { Layout } ;
44+
45+ export * from '@rspress/core/theme-original' ;
You can’t perform that action at this time.
0 commit comments