From 44b16b3c9081466af9b2be200ec50c2f2314ad26 Mon Sep 17 00:00:00 2001 From: Chris Villa Date: Thu, 14 Dec 2023 10:01:53 +0000 Subject: [PATCH] docs: make release switcher responsive --- apps/docs/components/FooterActions/index.tsx | 20 +++++++++++++++++++ .../FooterActions/styles.module.css | 18 +++++++++++++++++ .../docs/components/ReleaseSwitcher/index.tsx | 8 ++++++-- .../ReleaseSwitcher/styles.module.css | 5 +++++ apps/docs/components/Viewport/index.tsx | 18 +++++++++++++++++ .../components/Viewport/styles.module.css | 17 ++++++++++++++++ apps/docs/theme.config.tsx | 11 +++++++++- 7 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 apps/docs/components/FooterActions/index.tsx create mode 100644 apps/docs/components/FooterActions/styles.module.css create mode 100644 apps/docs/components/Viewport/index.tsx create mode 100644 apps/docs/components/Viewport/styles.module.css diff --git a/apps/docs/components/FooterActions/index.tsx b/apps/docs/components/FooterActions/index.tsx new file mode 100644 index 0000000000..b2eb8fddfd --- /dev/null +++ b/apps/docs/components/FooterActions/index.tsx @@ -0,0 +1,20 @@ +import { getClassNameFactory } from "@/core/lib"; + +import styles from "./styles.module.css"; +import { ThemeSwitch } from "nextra-theme-docs"; +import { ReleaseSwitcher } from "../ReleaseSwitcher"; + +const getClassName = getClassNameFactory("FooterActions", styles); + +export const FooterActions = () => { + return ( +
+
+ +
+
+ +
+
+ ); +}; diff --git a/apps/docs/components/FooterActions/styles.module.css b/apps/docs/components/FooterActions/styles.module.css new file mode 100644 index 0000000000..816828cf64 --- /dev/null +++ b/apps/docs/components/FooterActions/styles.module.css @@ -0,0 +1,18 @@ +.FooterActions { + align-items: center; + display: flex; + flex-wrap: wrap; + gap: 16px; + width: 100%; +} + +.FooterActions-releaseSwitcher { + display: block; + margin-left: auto; +} + +@media (min-width: 768px) { + .FooterActions-releaseSwitcher { + display: none; + } +} diff --git a/apps/docs/components/ReleaseSwitcher/index.tsx b/apps/docs/components/ReleaseSwitcher/index.tsx index 9981065344..653085678f 100644 --- a/apps/docs/components/ReleaseSwitcher/index.tsx +++ b/apps/docs/components/ReleaseSwitcher/index.tsx @@ -11,7 +11,11 @@ const { version } = packageJson; const getClassName = getClassNameFactory("ReleaseSwitcher", styles); -export const ReleaseSwitcher = () => { +export const ReleaseSwitcher = ({ + variant = "default", +}: { + variant?: "light" | "default"; +}) => { const isCanary = process.env.NEXT_PUBLIC_IS_CANARY === "true" || false; const isLatest = process.env.NEXT_PUBLIC_IS_LATEST === "true" || false; @@ -49,7 +53,7 @@ export const ReleaseSwitcher = () => { return (