1
0

layout.shared.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
  2. import { Heart } from 'lucide-react';
  3. import { Logo } from '@/components/logo';
  4. import { TelegramIcon } from '@/components/icons';
  5. import { appName, productRepoUrl, telegramChannel, telegramChannelUrl, donateUrl, siteUrl } from './shared';
  6. import { getSiteMessages } from './site-i18n';
  7. // Build locale-aware shared layout options. With `hideLocale: 'default-locale'`,
  8. // English URLs have no prefix while other locales are prefixed (`/fa`, `/ru`, `/zh`).
  9. export function baseOptions(lang: string): BaseLayoutProps {
  10. const prefix = lang === 'en' ? '' : `/${lang}`;
  11. const m = getSiteMessages(lang);
  12. return {
  13. nav: {
  14. title: (
  15. <span className="inline-flex items-center gap-2 font-semibold">
  16. <Logo className="h-6" />
  17. {appName}
  18. </span>
  19. ),
  20. url: `${prefix}/`,
  21. },
  22. githubUrl: productRepoUrl,
  23. links: [
  24. {
  25. text: m.documentation,
  26. url: `${prefix}/docs`,
  27. active: 'nested-url',
  28. },
  29. // Live component workbench built from frontend/ and published alongside the docs.
  30. {
  31. text: 'Storybook',
  32. url: `${siteUrl}/storybook/`,
  33. external: true,
  34. },
  35. {
  36. type: 'icon',
  37. label: `Telegram channel (@${telegramChannel})`,
  38. icon: <TelegramIcon />,
  39. text: 'Telegram',
  40. url: telegramChannelUrl,
  41. external: true,
  42. },
  43. // Compact heart icon in the top nav bars (home + docs).
  44. {
  45. type: 'icon',
  46. on: 'nav',
  47. label: m.donate,
  48. icon: <Heart />,
  49. text: m.donate,
  50. url: donateUrl,
  51. external: true,
  52. },
  53. // Prominent labelled entry in the docs sidebar / mobile menu.
  54. {
  55. type: 'main',
  56. on: 'menu',
  57. icon: <Heart />,
  58. text: m.donate,
  59. url: donateUrl,
  60. external: true,
  61. },
  62. ],
  63. };
  64. }