thin-footer.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import type {
  2. FooterItem,
  3. FooterMetadata,
  4. } from '@/shared/components/types/footer-metadata'
  5. import OLRow from '@/shared/components/ol/ol-row'
  6. import LanguagePicker from '@/shared/components/language-picker'
  7. import React from 'react'
  8. function FooterItemLi({
  9. text,
  10. translatedText,
  11. url: href,
  12. class: className,
  13. label,
  14. }: FooterItem) {
  15. const textToDisplay = translatedText || text
  16. if (!href) {
  17. return <li dangerouslySetInnerHTML={{ __html: textToDisplay }} />
  18. }
  19. const linkProps = {
  20. href,
  21. className,
  22. 'aria-label': label,
  23. }
  24. return (
  25. <li>
  26. <a {...linkProps}>{textToDisplay}</a>
  27. </li>
  28. )
  29. }
  30. function Separator() {
  31. return (
  32. <li role="separator" className="text-muted">
  33. <strong>|</strong>
  34. </li>
  35. )
  36. }
  37. function ThinFooter({
  38. showPoweredBy,
  39. subdomainLang,
  40. leftItems,
  41. rightItems,
  42. }: FooterMetadata) {
  43. const showLanguagePicker = Boolean(
  44. subdomainLang && Object.keys(subdomainLang).length > 1
  45. )
  46. const hasCustomLeftNav = Boolean(leftItems && leftItems.length > 0)
  47. return (
  48. <footer className="site-footer">
  49. <div className="site-footer-content d-print-none">
  50. <OLRow>
  51. <ul className="site-footer-items col-lg-9">
  52. {showPoweredBy ? (
  53. <>
  54. <li>
  55. {/* year of Server Pro release, static */}© 2025{' '}
  56. <a href="https://www.overleaf.com/for/enterprises">
  57. Powered by Overleaf
  58. </a>
  59. </li>
  60. {showLanguagePicker || hasCustomLeftNav ? <Separator /> : null}
  61. </>
  62. ) : null}
  63. {showLanguagePicker ? (
  64. <>
  65. <li>
  66. <LanguagePicker showHeader />
  67. </li>
  68. {hasCustomLeftNav ? <Separator /> : null}
  69. </>
  70. ) : null}
  71. {leftItems?.map(item => (
  72. <FooterItemLi key={item.text} {...item} />
  73. ))}
  74. </ul>
  75. <ul className="site-footer-items col-lg-3 text-end">
  76. {rightItems?.map(item => (
  77. <FooterItemLi key={item.text} {...item} />
  78. ))}
  79. </ul>
  80. </OLRow>
  81. </div>
  82. </footer>
  83. )
  84. }
  85. export default ThinFooter