From 9910073432e9763a380b8e619a0d00f08bf76a09 Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Tue, 26 Sep 2023 13:57:45 -0230 Subject: [PATCH] Chore/proper theme switcher (#17635) * Add theme switcher * Update * Update * Fix docs * Update * Fix www * Componentize ThemeToggle * Remove unused TopBarRef, rename existing component * Update apps/www/pages/launch-week/6/index.tsx Co-authored-by: Greg Richardson * Update apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx Co-authored-by: Greg Richardson * Update apps/www/pages/launch-week/index.tsx Co-authored-by: Greg Richardson * Update apps/www/pages/launch-week/7/index.tsx Co-authored-by: Greg Richardson * Update apps/www/pages/launch-week/tickets/[username].tsx Co-authored-by: Greg Richardson * Update always-on darkmode pages * update * Prettier * Check resolved theme for images * use resolved theme * Fix customer stories * Update apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx Co-authored-by: Francesco Sansalvadore --------- Co-authored-by: Greg Richardson Co-authored-by: Francesco Sansalvadore --- apps/docs/components/Frameworks.tsx | 6 +- .../Navigation/NavigationMenu/HomeMenu.tsx | 6 - .../NavigationMenuGuideListItems.tsx | 7 +- .../Navigation/NavigationMenu/TopNavBar.tsx | 173 ++-- .../NavigationMenu/TopNavBarRef.tsx | 148 --- apps/docs/layouts/SiteLayout.tsx | 10 +- apps/docs/pages/_app.tsx | 7 +- apps/docs/pages/_document.tsx | 2 +- apps/docs/public/sitemap.xml | 357 ++++++- .../AuthWidget/AuthWidgetSection.tsx | 6 +- apps/www/components/CustomerStories/index.tsx | 3 +- apps/www/components/DarkModeToggle.tsx | 38 - apps/www/components/Footer/index.tsx | 11 +- apps/www/components/Globe.tsx | 8 +- apps/www/components/Nav/index.tsx | 13 +- apps/www/components/OpenSource/OSSHero.tsx | 7 +- .../Pricing/ComputePricingModal.tsx | 6 +- .../Products/VectorAI/CustomersVisual.tsx | 242 +++-- .../Products/VectorAI/DeployGlobally.tsx | 8 +- .../Products/VectorAI/IntegrationsImage.tsx | 11 +- .../Products/VectorAI/OpenAIImage.tsx | 28 +- .../Products/VectorAI/PGvectorImg.tsx | 32 +- .../VectorAI/SecureAndScalableImg.tsx | 36 +- .../Sections/CustomerQuotesSection.tsx | 8 +- apps/www/data/products/vector/pageData.tsx | 2 +- apps/www/pages/404.tsx | 6 +- apps/www/pages/_app.tsx | 12 +- apps/www/pages/_document.tsx | 2 +- apps/www/pages/careers/index.tsx | 14 +- apps/www/pages/index.tsx | 15 - apps/www/pages/launch-week/6/index.tsx | 61 +- apps/www/pages/launch-week/7/index.tsx | 13 +- .../launch-week/7/tickets/[username].tsx | 6 +- .../www/pages/launch-week/7/tickets/index.tsx | 6 +- apps/www/pages/launch-week/index.tsx | 15 +- .../pages/launch-week/tickets/[username].tsx | 15 +- apps/www/pages/launch-week/tickets/index.tsx | 10 +- apps/www/pages/pricing/index.tsx | 12 +- apps/www/public/customers-rss.xml | 22 +- .../planetpg-angelico_de_los_reyes-rss.xml | 10 +- apps/www/public/planetpg-ant_wilson-rss.xml | 4 +- apps/www/public/planetpg-bo_lu-rss.xml | 4 +- apps/www/public/planetpg-burggraf-rss.xml | 6 +- apps/www/public/planetpg-egor_romanov-rss.xml | 6 +- apps/www/public/planetpg-gregnr-rss.xml | 8 +- apps/www/public/planetpg-michel-rss.xml | 6 +- apps/www/public/planetpg-oli_rice-rss.xml | 16 +- .../public/planetpg-paul_copplestone-rss.xml | 14 +- apps/www/public/planetpg-pavel-rss.xml | 8 +- apps/www/public/planetpg-steve_chavez-rss.xml | 6 +- apps/www/public/planetpg-victor-rss.xml | 8 +- apps/www/public/rss.xml | 425 ++++---- apps/www/public/sitemap_www.xml | 940 +++--------------- package-lock.json | 13 + package.json | 3 + packages/common/Providers.tsx | 78 +- packages/ui/index.tsx | 3 + .../ui/src/components/CodeBlock/CodeBlock.tsx | 11 +- .../Command/CommandMenuProvider.tsx | 9 - .../src/components/Command/ThemeOptions.tsx | 18 +- .../src/components/GlassPanel/GlassPanel.tsx | 8 +- .../ui/src/components/IconPanel/IconPanel.tsx | 12 +- .../components/ThemeProvider/ThemeToggle.tsx | 55 + .../interfaces/App/AppBannerWrapper.tsx | 12 +- .../AddNewPaymentMethodModal.tsx | 6 +- .../BillingV2/Subscription/AddOns/AddOns.tsx | 21 +- .../Subscription/CostControl/CostControl.tsx | 13 +- .../CostControl/SpendCapSidePanel.tsx | 7 +- .../Database/Schemas/SchemaGraph.tsx | 13 +- .../Wrappers/WrappersDisabledState.tsx | 13 +- .../interfaces/Home/ExampleProject.tsx | 12 +- .../CostControl/CostControl.tsx | 13 +- .../CostControl/SpendCapSidePanel.tsx | 7 +- .../interfaces/Settings/Addons/Addons.tsx | 23 +- .../Addons/ComputeInstanceSidePanel.tsx | 7 +- .../Settings/Addons/PITRSidePanel.tsx | 7 +- .../interfaces/Settings/Vault/VaultToggle.tsx | 12 +- .../TableGridEditor/TableDefinition.tsx | 7 +- .../layouts/APIAuthorizationLayout.tsx | 6 +- .../AppLayout/UserSettingsDropdown.tsx | 10 +- .../NavigationBar/NavigationBar.tsx | 15 +- .../SignInLayout/ForgotPasswordLayout.tsx | 6 +- .../layouts/SignInLayout/SignInLayout.tsx | 6 +- .../ui/CodeEditor/CodeEditor.utils.ts | 14 +- studio/pages/404.tsx | 7 +- studio/pages/500.tsx | 6 +- studio/pages/_app.tsx | 7 +- studio/pages/_document.tsx | 2 +- studio/pages/account/me.tsx | 16 +- studio/pages/new/index.tsx | 7 +- studio/pages/project/[ref]/api/graphiql.tsx | 8 +- studio/pages/project/[ref]/editor/[id].tsx | 6 +- 92 files changed, 1461 insertions(+), 1883 deletions(-) delete mode 100644 apps/docs/components/Navigation/NavigationMenu/TopNavBarRef.tsx delete mode 100644 apps/www/components/DarkModeToggle.tsx create mode 100644 packages/ui/src/components/ThemeProvider/ThemeToggle.tsx diff --git a/apps/docs/components/Frameworks.tsx b/apps/docs/components/Frameworks.tsx index 2b88f604748..baa4da4efb7 100644 --- a/apps/docs/components/Frameworks.tsx +++ b/apps/docs/components/Frameworks.tsx @@ -1,8 +1,8 @@ import ButtonCard from './ButtonCard' -import { useTheme } from 'common/Providers' +import { useTheme } from 'next-themes' const Frameworks = () => { - const { isDarkMode } = useTheme() + const { theme } = useTheme() const frameworks = [ { @@ -111,7 +111,7 @@ const Frameworks = () => { to={x.href} title={x.name} // [Joshen] Nice to have: theming - icon={isDarkMode ? x.logo.dark : x.logo.light} + icon={theme === 'dark' ? x.logo.dark : x.logo.light} /> ))} diff --git a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx index e94da27828e..9800235c5fe 100644 --- a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx @@ -1,16 +1,10 @@ -import { useTheme } from 'common/Providers' -import Image from 'next/image' import Link from 'next/link' -import { useRouter } from 'next/router' import { Fragment } from 'react' import { Badge, cn } from 'ui' import { HOMEPAGE_MENU_ITEMS } from './NavigationMenu.constants' import HomeMenuIconPicker from './HomeMenuIconPicker' const NavigationMenuHome = () => { - const router = useRouter() - const { isDarkMode } = useTheme() - return (