@@ -20,8 +20,11 @@ import { useColorMode } from '@docusaurus/theme-common';
2020
2121import { Icon } from '@iconify/react' ;
2222
23+ // add for responsive logo image
24+ import { useWindowSize } from '@docusaurus/theme-common' ;
25+
2326// Custom styles to fix the spacing issue
24- const socialIconsContainerStyle = {
27+ const socialIconsContainerStyle : React . CSSProperties = {
2528 display : 'flex' ,
2629 justifyContent : 'center' ,
2730 alignItems : 'center' ,
@@ -71,15 +74,36 @@ const FooterLogo = ({
7174 alt,
7275 width,
7376 height,
74- } : Pick < ThemedImageProps , 'sources' | 'alt' | 'width' | 'height' > ) => (
75- < ThemedImage
76- className = "footer__logo"
77- alt = { alt }
78- sources = { sources }
79- width = { width }
80- height = { height }
81- />
82- ) ;
77+ logo,
78+ } : Pick < ThemedImageProps , 'sources' | 'alt' | 'width' | 'height' > & { logo : any } ) => {
79+ // Get window width for responsiveness
80+ const windowSize = useWindowSize ( ) ;
81+
82+ // Set threshold for mobile view (e.g., 768px)
83+ const isMobile = windowSize === 'mobile' ? true : false ;
84+
85+ const getMobileLogoPath = ( path : string ) => path ?. replace ( '.svg' , '-mobile.svg' ) ;
86+
87+ // Choose appropriate image sources based on screen size
88+ // const responsiveSources = {
89+ // light: useBaseUrl(isMobile ? getMobileLogoPath(logo.src) : logo.src),
90+ // dark: useBaseUrl(isMobile ? getMobileLogoPath(logo.srcDark || logo.src) : (logo.srcDark || logo.src)),
91+ // };
92+ const responsiveSources = {
93+ light : useBaseUrl ( isMobile ? getMobileLogoPath ( logo ?. src ) : logo ?. src ) ,
94+ dark : useBaseUrl ( isMobile ? getMobileLogoPath ( logo ?. srcDark || logo ?. src ) : ( logo ?. srcDark || logo ?. src ) ) ,
95+ } ;
96+
97+ return (
98+ < ThemedImage
99+ className = "footer__logo"
100+ alt = { alt }
101+ sources = { responsiveSources }
102+ width = { width }
103+ height = { height }
104+ />
105+ ) ;
106+ }
83107
84108function Footer ( ) : JSX . Element | null {
85109 const socialLinks = {
@@ -94,7 +118,7 @@ function Footer(): JSX.Element | null {
94118
95119 const { footer} = useThemeConfig ( ) ;
96120
97- const { copyright, links = [ ] , logo = { } } = footer || { } ;
121+ const { copyright, links = [ ] , logo = { src : '' } } = footer || { } ;
98122 const sources = {
99123 light : useBaseUrl ( logo . src ) ,
100124 dark : useBaseUrl ( logo . srcDark || logo . src ) ,
@@ -115,15 +139,15 @@ function Footer(): JSX.Element | null {
115139 < div className = "row footer__links" >
116140 < div className = "col col--6 footer__col" >
117141 { logo && ( logo . src || logo . srcDark ) && (
118- < div className = "margin-bottom--sm" >
119- { logo . href ? (
120- < Link href = { logo . href } className = { styles . footerLogoLink } >
121- < FooterLogo alt = { logo . alt } sources = { sources } />
122- </ Link >
123- ) : (
124- < FooterLogo alt = { logo . alt } sources = { sources } />
125- ) }
126- </ div >
142+ < div className = "margin-bottom--sm" >
143+ { logo . href ? (
144+ < Link href = { logo . href } className = { styles . footerLogoLink } >
145+ < FooterLogo alt = { logo . alt } sources = { sources } logo = { logo } />
146+ </ Link >
147+ ) : (
148+ < FooterLogo alt = { logo . alt } sources = { sources } logo = { logo } />
149+ ) }
150+ </ div >
127151 ) }
128152 < p className = "footer__subtitle" >
129153 A new approach to querying and < br />
0 commit comments