diff --git a/apps/documentation/src/components/Footer/Footer.tsx b/apps/documentation/src/components/Footer/Footer.tsx new file mode 100644 index 00000000..f97d27bd --- /dev/null +++ b/apps/documentation/src/components/Footer/Footer.tsx @@ -0,0 +1,182 @@ +import type { JSX } from 'react' +import { Link } from 'tuono' +import { + Container, + Box, + AppShell, + Title, + Divider, + Flex, + Text, + Anchor, +} from '@mantine/core' +import type { MantineSize } from '@mantine/core' + +interface LinkData { + title: string + url: string +} + +interface FooterLinkListProps { + title: string + links: Array + hiddenFrom?: MantineSize +} + +const aboutLinks: Array = [ + { title: 'Contribute', url: '/documentation/contributing' }, + { + title: 'GitHub releases', + url: 'https://github.com/tuono-labs/tuono/releases', + }, +] + +const communityLinks: Array = [ + { title: 'Chat on Discord', url: 'https://discord.com/invite/khQzPa654B' }, + { title: 'Follow on X', url: 'https://twitter.com/valerioageno' }, + { title: 'Follow on GitHub', url: 'https://github.com/tuono-labs' }, +] + +const legalLinks: Array = [ + { title: 'Privacy Policy', url: '/policies/privacy' }, +] + +function FooterLink({ link }: { link: LinkData }): JSX.Element { + const component = link.url.startsWith('http') ? undefined : Link + const target = link.url.startsWith('http') ? '_blank' : undefined + return ( + + + {link.title} + + + ) +} + +function FooterLinkList({ + title, + links, + hiddenFrom, +}: FooterLinkListProps): JSX.Element { + return ( + + + {title} + + {links.map((link) => ( + + ))} + + ) +} + +function FooterTitle(): JSX.Element { + const size = 44 + return ( + + + Tuono + + Tuono + + + Simply the fastest full-stack web framework ⚡ + + ) +} + +function TocPlaceholder(): JSX.Element { + return ( + + ) +} + +function FooterOutro(): JSX.Element { + const fontSize = 14 + return ( + + + + Built by{' '} + + Valerio Ageno + {' '} + and{' '} + + these awesome people + + + + + Privacy Policy + + + + ) +} + +export default function Footer(): JSX.Element { + return ( + + + + + + + + + + + + + + + + + + ) +} diff --git a/apps/documentation/src/components/Footer/index.ts b/apps/documentation/src/components/Footer/index.ts new file mode 100644 index 00000000..9c7e8318 --- /dev/null +++ b/apps/documentation/src/components/Footer/index.ts @@ -0,0 +1,3 @@ +import Footer from './Footer' + +export default Footer diff --git a/apps/documentation/src/components/MdxProvider/MdxCode/MdxCode.tsx b/apps/documentation/src/components/MdxProvider/MdxCode/MdxCode.tsx index 87269f28..0a3d5a57 100644 --- a/apps/documentation/src/components/MdxProvider/MdxCode/MdxCode.tsx +++ b/apps/documentation/src/components/MdxProvider/MdxCode/MdxCode.tsx @@ -4,6 +4,5 @@ import { Code } from '@mantine/core' export default function MdxCode( props: HTMLAttributes, ): JSX.Element { - console.log(props) return } diff --git a/apps/documentation/src/components/PageWithTOC/PageWithTOC.tsx b/apps/documentation/src/components/PageWithTOC/PageWithTOC.tsx index e3fdab87..e08b4737 100644 --- a/apps/documentation/src/components/PageWithTOC/PageWithTOC.tsx +++ b/apps/documentation/src/components/PageWithTOC/PageWithTOC.tsx @@ -1,5 +1,7 @@ import type { JSX, ReactNode } from 'react' +import { useEffect, useRef, useState } from 'react' import { Box, Container } from '@mantine/core' +import { useViewportSize } from '@mantine/hooks' import TableOfContents from '@/components/TableOfContents' @@ -10,24 +12,51 @@ interface PageWithTOCProps { } export function PageWithTOC({ children }: PageWithTOCProps): JSX.Element { - return ( - - - {children} - + const { width } = useViewportSize() + const [footerHeight, setFooterHeight] = useState(0) + const mainRef = useRef(null) + const height = `calc(100% - ${footerHeight}px)` - - + useEffect(() => { + const footer = document.getElementById('app-footer') + + if (footer) { + setFooterHeight(footer.clientHeight) + } + }, [ + setFooterHeight, + // Reload on window width resize + width, + ]) + + return ( + <> + + + + {children} + + + + + + ) } diff --git a/apps/documentation/src/routes/__layout.tsx b/apps/documentation/src/routes/__layout.tsx index 53341f36..b8cc49eb 100644 --- a/apps/documentation/src/routes/__layout.tsx +++ b/apps/documentation/src/routes/__layout.tsx @@ -18,6 +18,7 @@ import MdxProvider from '@/components/MdxProvider' import '@mantine/core/styles.css' import '@mantine/code-highlight/styles.css' +import Footer from '@/components/Footer' interface RootRouteProps { children: ReactNode @@ -81,11 +82,13 @@ const resolver: CSSVariablesResolver = (th) => { return { variables: {}, light: { + '--mantine-color-footer-bg': th.colors.gray[1], '--mantine-color-sidebar-gray': sidebarGrayLight, '--mantine-color-sidebar-text-hover': sidebarTextHoverLight, '--mantine-color-quote-border': th.colors.violet[1], }, dark: { + '--mantine-color-footer-bg': th.colors.dark[6], '--mantine-color-sidebar-gray': sidebarGrayDark, '--mantine-color-sidebar-text-hover': sidebarTextHoverDark, '--mantine-color-quote-border': th.colors.violet[9], @@ -139,6 +142,7 @@ export default function RootRoute({ children }: RootRouteProps): JSX.Element { {children} +