|
| 1 | +import { useRouter } from "next/router"; |
| 2 | +import Link from "next/link"; |
| 3 | +import { useState } from "react"; |
| 4 | + |
| 5 | +const Vercel = ({ height = 20 }) => ( |
| 6 | + <svg height={height} viewBox="0 0 283 64" fill="none"> |
| 7 | + <path |
| 8 | + fill="currentColor" |
| 9 | + d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" |
| 10 | + /> |
| 11 | + </svg> |
| 12 | +); |
| 13 | + |
| 14 | +function FooterLink({ href, children }) { |
| 15 | + const classes = |
| 16 | + "text-sm text-gray-500 no-underline betterbetterhover:hover:betterhover:hover:text-gray-700 betterbetterhover:hover:dark:betterhover:hover:text-white transition"; |
| 17 | + if (href.startsWith("http")) { |
| 18 | + return ( |
| 19 | + <a href={href} className={classes}> |
| 20 | + {children} |
| 21 | + </a> |
| 22 | + ); |
| 23 | + } |
| 24 | + return ( |
| 25 | + <Link href={href}> |
| 26 | + <a className={classes}>{children}</a> |
| 27 | + </Link> |
| 28 | + ); |
| 29 | +} |
| 30 | + |
| 31 | +function FooterHeader({ children }) { |
| 32 | + return <h3 className="text-sm text-gray-900 dark:text-white">{children}</h3>; |
| 33 | +} |
| 34 | + |
| 35 | +const navigation = { |
| 36 | + general: [ |
| 37 | + { name: "Documentation", href: "/docs" }, |
| 38 | + { name: "API Reference", href: "/docs/reference/command-line-reference" }, |
| 39 | + { name: "Blog", href: "/blog" }, |
| 40 | + { name: "Releases", href: "https://github.com/vercel/turborepo/releases" }, |
| 41 | + { name: "FAQ", href: "/docs/faq" }, |
| 42 | + ], |
| 43 | + support: [ |
| 44 | + { |
| 45 | + name: "GitHub", |
| 46 | + href: "https://github.com/vercel/turborepo", |
| 47 | + }, |
| 48 | + ], |
| 49 | + company: [ |
| 50 | + { |
| 51 | + name: "Open Source Software", |
| 52 | + href: "https://vercel.com/oss?utm_source=turborepo.org&utm_medium=referral&utm_campaign=footer-ossLink", |
| 53 | + }, |
| 54 | + { name: "GitHub", href: "https://github.com/vercel" }, |
| 55 | + { name: "Twitter", href: "https://twitter.com/vercel" }, |
| 56 | + ], |
| 57 | + legal: [ |
| 58 | + { name: "Privacy Policy", href: "/privacy" }, |
| 59 | + { name: "Terms of Use", href: "/terms" }, |
| 60 | + ], |
| 61 | +}; |
| 62 | + |
| 63 | +export function Footer() { |
| 64 | + return ( |
| 65 | + <footer className="" aria-labelledby="footer-heading"> |
| 66 | + <h2 id="footer-heading" className="sr-only"> |
| 67 | + Footer |
| 68 | + </h2> |
| 69 | + <div className="py-8 mx-auto max-w-7xl"> |
| 70 | + <div className="xl:grid xl:grid-cols-3 xl:gap-8"> |
| 71 | + <div className="grid grid-cols-2 gap-8 xl:col-span-2"> |
| 72 | + <div className="md:grid md:grid-cols-2 md:gap-8"> |
| 73 | + <div> |
| 74 | + <FooterHeader>Solutions</FooterHeader> |
| 75 | + <ul role="list" className="mt-4 space-y-1.5 list-none ml-0"> |
| 76 | + {navigation.general.map((item) => ( |
| 77 | + <li key={item.name}> |
| 78 | + <FooterLink href={item.href}>{item.name}</FooterLink> |
| 79 | + </li> |
| 80 | + ))} |
| 81 | + </ul> |
| 82 | + </div> |
| 83 | + <div className="mt-12 md:mt-0"> |
| 84 | + <FooterHeader>Support</FooterHeader> |
| 85 | + <ul role="list" className="mt-4 space-y-1.5 list-none ml-0"> |
| 86 | + {navigation.support.map((item) => ( |
| 87 | + <li key={item.name}> |
| 88 | + <FooterLink href={item.href}>{item.name}</FooterLink> |
| 89 | + </li> |
| 90 | + ))} |
| 91 | + </ul> |
| 92 | + </div> |
| 93 | + </div> |
| 94 | + <div className="md:grid md:grid-cols-2 md:gap-8"> |
| 95 | + <div> |
| 96 | + <FooterHeader>Company</FooterHeader> |
| 97 | + <ul role="list" className="mt-4 space-y-1.5 list-none ml-0"> |
| 98 | + {navigation.company.map((item) => ( |
| 99 | + <li key={item.name}> |
| 100 | + <FooterLink href={item.href}>{item.name}</FooterLink> |
| 101 | + </li> |
| 102 | + ))} |
| 103 | + </ul> |
| 104 | + </div> |
| 105 | + <div className="mt-12 md:mt-0"> |
| 106 | + <FooterHeader>Legal</FooterHeader> |
| 107 | + <ul role="list" className="mt-4 space-y-1.5 list-none ml-0"> |
| 108 | + {navigation.legal.map((item) => ( |
| 109 | + <li key={item.name}> |
| 110 | + <FooterLink href={item.href}>{item.name}</FooterLink> |
| 111 | + </li> |
| 112 | + ))} |
| 113 | + </ul> |
| 114 | + </div> |
| 115 | + </div> |
| 116 | + </div> |
| 117 | + <div className=""> |
| 118 | + <FooterHeader>Subscribe to our newsletter</FooterHeader> |
| 119 | + <p className="mt-4 text-sm text-gray-600 dark:text-gray-500"> |
| 120 | + Join the Turborepo newsletter and stay updated on new releases and |
| 121 | + features, guides, and case studies. |
| 122 | + </p> |
| 123 | + <SubmitForm /> |
| 124 | + </div> |
| 125 | + </div> |
| 126 | + |
| 127 | + <div className="pt-8 mt-8 md:flex md:items-center md:justify-between"> |
| 128 | + <div> |
| 129 | + <a |
| 130 | + className="text-current" |
| 131 | + target="_blank" |
| 132 | + rel="noopener noreferrer" |
| 133 | + href="https://vercel.com?utm_source=turborepo.org&utm_medium=referral&utm_campaign=footer-logoLink" |
| 134 | + > |
| 135 | + <Vercel /> |
| 136 | + </a> |
| 137 | + <p className="mt-4 text-xs text-gray-500 "> |
| 138 | + © {new Date().getFullYear()} Vercel, Inc. All rights |
| 139 | + reserved. |
| 140 | + </p> |
| 141 | + </div> |
| 142 | + </div> |
| 143 | + </div> |
| 144 | + </footer> |
| 145 | + ); |
| 146 | +} |
| 147 | + |
| 148 | +function SubmitForm() { |
| 149 | + const [email, setEmail] = useState(""); |
| 150 | + const router = useRouter(); |
| 151 | + return ( |
| 152 | + <form |
| 153 | + className="mt-4 sm:flex sm:max-w-md" |
| 154 | + onSubmit={(e) => { |
| 155 | + fetch("/api/signup", { |
| 156 | + method: "POST", |
| 157 | + headers: { |
| 158 | + "Content-Type": "application/json", |
| 159 | + }, |
| 160 | + body: JSON.stringify({ email }), |
| 161 | + }) |
| 162 | + .then((res) => res.json()) |
| 163 | + .then((res) => { |
| 164 | + return router.push("/confirm"); |
| 165 | + }); |
| 166 | + e.preventDefault(); |
| 167 | + }} |
| 168 | + > |
| 169 | + <label htmlFor="email-address" className="sr-only"> |
| 170 | + Email address |
| 171 | + </label> |
| 172 | + <input |
| 173 | + type="email" |
| 174 | + name="email-address" |
| 175 | + id="email-address" |
| 176 | + autoComplete="email" |
| 177 | + required |
| 178 | + value={email} |
| 179 | + onChange={(e) => setEmail(e.target.value)} |
| 180 | + className="w-full min-w-0 px-4 py-2 text-base text-gray-900 placeholder-gray-500 bg-white border border-transparent rounded-md appearance-none dark:text-white sm:text-sm dark:border-gray-700 dark:bg-transparent focus:outline-none focus:ring-2 focus:ring-gray-800 dark:focus:border-white focus:placeholder-gray-400" |
| 181 | + |
| 182 | + /> |
| 183 | + <div className="mt-3 rounded-md sm:mt-0 sm:ml-3 sm:flex-shrink-0"> |
| 184 | + <button |
| 185 | + type="submit" |
| 186 | + className="flex items-center justify-center w-full px-4 py-2 text-base font-medium text-white bg-black dark:bg-white dark:text-black border border-transparent rounded-md sm:text-sm betterhover:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-800 dark:focus:ring-white dark:betterhover:hover:bg-gray-300" |
| 187 | + > |
| 188 | + Subscribe |
| 189 | + </button> |
| 190 | + </div> |
| 191 | + </form> |
| 192 | + ); |
| 193 | +} |
0 commit comments