From dc805dbad74bfbf2bfb6dcd223bc3f07a985810a Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Thu, 1 Aug 2024 17:00:34 +0300 Subject: [PATCH 1/6] chore(web): add `main-footer` to docs and remove duplicate --- apps/web/app/docs/[[...slug]]/page.tsx | 98 ------------------- apps/web/app/docs/layout.tsx | 2 + apps/web/app/page.tsx | 3 +- apps/web/components/homepage/index.ts | 1 - .../components/{homepage => }/main-footer.tsx | 0 5 files changed, 3 insertions(+), 101 deletions(-) rename apps/web/components/{homepage => }/main-footer.tsx (100%) diff --git a/apps/web/app/docs/[[...slug]]/page.tsx b/apps/web/app/docs/[[...slug]]/page.tsx index f040d0319..0f85ce5de 100644 --- a/apps/web/app/docs/[[...slug]]/page.tsx +++ b/apps/web/app/docs/[[...slug]]/page.tsx @@ -62,7 +62,6 @@ export default function DocPage({ params }: Props) { - @@ -150,103 +149,6 @@ function DocsPager({ doc }: { doc: Doc }) { ); } -function DocFooter() { - return ( -
-
-
-
- - - Flowbite React - -

- Flowbite is an ecosystem built on top of Tailwind CSS including a component library, block sections, a - Figma design system and other resources. -

-

- Code licensed{" "} - - MIT - - , docs{" "} - - CC BY 3.0 - -

-
-
-
- - - - GitHub - - - Flowbite - - - Tailwind CSS - - - Figma - - -
-
- - - - Discord - - - Github Discussions - - -
-
- - - - License - - - Brand guideline - - -
-
-
- -
- -
-
-
- ); -} - function ToC({ doc }: { doc: Doc }) { return (
diff --git a/apps/web/app/docs/layout.tsx b/apps/web/app/docs/layout.tsx index 6d612d1a2..8c91b406d 100644 --- a/apps/web/app/docs/layout.tsx +++ b/apps/web/app/docs/layout.tsx @@ -9,6 +9,7 @@ import { useEffect, useState } from "react"; import { HiMenuAlt1, HiX } from "react-icons/hi"; import { twMerge } from "tailwind-merge"; import { DocSearchInput } from "~/components/docsearch-input"; +import { MainFooter } from "~/components/main-footer"; import { NavbarIcons, NavbarLinks } from "~/components/navbar"; import { DOCS_SIDEBAR, type DocsSidebarItem } from "~/data/docs-sidebar"; @@ -36,6 +37,7 @@ export default function DocsLayout({ children }: PropsWithChildren) {
{children}
+ ); diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 11ba98e32..dfb6d2c50 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -1,4 +1,3 @@ -import { Banner } from "~/components/banner"; import { ComponentsSection, ContributorsSection, @@ -7,11 +6,11 @@ import { FigmaSection, HeroSection, HomeNavbar, - MainFooter, ReactSection, SocialProofSection, TailwindSection, } from "~/components/homepage"; +import { MainFooter } from "~/components/main-footer"; export default function HomePage() { return ( diff --git a/apps/web/components/homepage/index.ts b/apps/web/components/homepage/index.ts index f9e0f8deb..f5d8a28b0 100644 --- a/apps/web/components/homepage/index.ts +++ b/apps/web/components/homepage/index.ts @@ -5,7 +5,6 @@ export { FeaturedSection } from "./featured-section"; export { FigmaSection } from "./figma-section"; export { HeroSection } from "./hero-section"; export { HomeNavbar } from "./home-navbar"; -export { MainFooter } from "./main-footer"; export { ReactSection } from "./react-section"; export { SocialProofSection } from "./social-proof-section"; export { TailwindSection } from "./tailwind-section"; diff --git a/apps/web/components/homepage/main-footer.tsx b/apps/web/components/main-footer.tsx similarity index 100% rename from apps/web/components/homepage/main-footer.tsx rename to apps/web/components/main-footer.tsx From 0b0b95a1d3f9c3c0bd31981578d1d866976f845e Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Thu, 1 Aug 2024 17:02:14 +0300 Subject: [PATCH 2/6] chore(web): - reuse `fetchSafe` - omit `github-actions[bot]` from contributors list --- apps/web/components/homepage/contributors-section.tsx | 8 +++++--- apps/web/components/homepage/social-proof-section.tsx | 6 +----- apps/web/helpers/http.ts | 10 +++++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/web/components/homepage/contributors-section.tsx b/apps/web/components/homepage/contributors-section.tsx index 61edadb7f..5ca4f2679 100644 --- a/apps/web/components/homepage/contributors-section.tsx +++ b/apps/web/components/homepage/contributors-section.tsx @@ -1,7 +1,7 @@ import { Tooltip } from "flowbite-react"; import Image from "next/image"; import Link from "next/link"; -import { safeResJson } from "~/helpers/http"; +import { fetchSafe } from "~/helpers/http"; interface Contributor { id: number; @@ -12,9 +12,11 @@ interface Contributor { async function fetchContributors(): Promise { try { - const result = await fetch("https://api.github.com/repos/themesberg/flowbite-react/contributors?per_page=21"); + const result = await fetchSafe( + "https://api.github.com/repos/themesberg/flowbite-react/contributors?per_page=21", + ); - return safeResJson(result); + return result.filter((contributor) => contributor.login !== "github-actions[bot]"); } catch (error) { return []; } diff --git a/apps/web/components/homepage/social-proof-section.tsx b/apps/web/components/homepage/social-proof-section.tsx index cd80f3dc2..04d27ef06 100644 --- a/apps/web/components/homepage/social-proof-section.tsx +++ b/apps/web/components/homepage/social-proof-section.tsx @@ -1,9 +1,5 @@ import Image from "next/image"; -import { safeResJson } from "~/helpers/http"; - -async function fetchSafe(endpoint: string): Promise { - return safeResJson(await fetch(endpoint)); -} +import { fetchSafe } from "~/helpers/http"; async function fetchStargazers(): Promise { try { diff --git a/apps/web/helpers/http.ts b/apps/web/helpers/http.ts index 2a5605219..0a93c1703 100644 --- a/apps/web/helpers/http.ts +++ b/apps/web/helpers/http.ts @@ -1,5 +1,9 @@ -export function safeResJson(res: Response) { - if (res.ok) return res.json() as Promise; +export async function fetchSafe(endpoint: string): Promise { + const response = await fetch(endpoint); - throw new Error("Internal server error!"); + if (!response.ok) { + throw new Error("Internal server error!"); + } + + return response.json(); } From cc65fd4104034cbf606abcd652095dfe575f9b7c Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Thu, 1 Aug 2024 17:15:56 +0300 Subject: [PATCH 3/6] fix datepicker tests --- .../ui/src/components/Datepicker/Datepicker.spec.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/ui/src/components/Datepicker/Datepicker.spec.tsx b/packages/ui/src/components/Datepicker/Datepicker.spec.tsx index 81f5814c1..21d913a75 100644 --- a/packages/ui/src/components/Datepicker/Datepicker.spec.tsx +++ b/packages/ui/src/components/Datepicker/Datepicker.spec.tsx @@ -80,7 +80,7 @@ describe("Components / Datepicker", () => { it("should render 1990 - 2100 year range when selecting decade", async () => { const testDate = new Date(2024, 6, 20); - render(); + render(); const textBox = screen.getByRole("textbox"); await userEvent.click(textBox); @@ -96,7 +96,7 @@ describe("Components / Datepicker", () => { it("should allow selecting earlier decades when setting max date", async () => { const testDate = new Date(2024, 6, 20); - render(); + render(); const textBox = screen.getByRole("textbox"); await userEvent.click(textBox); @@ -113,7 +113,7 @@ describe("Components / Datepicker", () => { it("should disallow selecting later decades when setting max date", async () => { const testDate = new Date(2024, 6, 20); - render(); + render(); const textBox = screen.getByRole("textbox"); await userEvent.click(textBox); @@ -130,7 +130,7 @@ describe("Components / Datepicker", () => { it("should disallow selecting earlier decades when setting min date", async () => { const testDate = new Date(2024, 6, 20); - render(); + render(); const textBox = screen.getByRole("textbox"); await userEvent.click(textBox); @@ -147,7 +147,7 @@ describe("Components / Datepicker", () => { it("should allow selecting later decades when setting min date", async () => { const testDate = new Date(2024, 6, 20); - render(); + render(); const textBox = screen.getByRole("textbox"); await userEvent.click(textBox); @@ -167,7 +167,7 @@ describe("Components / Datepicker", () => { const maxDate = new Date(2030, 1, 1); const testDate = new Date(2024, 6, 1); - render(); + render(); const textBox = screen.getByRole("textbox"); await userEvent.click(textBox); From b51a5ec9c3a259fe72e20cc94148369c4385c131 Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Thu, 1 Aug 2024 17:40:27 +0300 Subject: [PATCH 4/6] chore(web): open `main-footer` links in new tab --- apps/web/components/main-footer.tsx | 39 +++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/apps/web/components/main-footer.tsx b/apps/web/components/main-footer.tsx index 02859c2df..f59070688 100644 --- a/apps/web/components/main-footer.tsx +++ b/apps/web/components/main-footer.tsx @@ -20,6 +20,8 @@ export function MainFooter() { Code licensed{" "} MIT @@ -28,6 +30,7 @@ export function MainFooter() { CC BY 3.0 @@ -41,16 +44,26 @@ export function MainFooter() { className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white" /> - + GitHub - + Flowbite - + Tailwind CSS - + Figma @@ -61,10 +74,20 @@ export function MainFooter() { className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white" /> - + Discord - + Github Discussions @@ -75,10 +98,10 @@ export function MainFooter() { className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white" /> - + License - + Brand guideline From 7ef8849866c89fd26b81aecbfe7a8bded0d61677 Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Thu, 1 Aug 2024 17:46:27 +0300 Subject: [PATCH 5/6] chore(web): navbar - add `rel` attribute to all `a` tags that have `target="_blank"` --- apps/web/components/navbar.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/web/components/navbar.tsx b/apps/web/components/navbar.tsx index 2a76f06dd..f7fe4faaf 100644 --- a/apps/web/components/navbar.tsx +++ b/apps/web/components/navbar.tsx @@ -45,6 +45,7 @@ export function NavbarIcons() { - + v{version} From d1e6e83ff8a3fb5f39537e3dbd17a0740f488842 Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Thu, 1 Aug 2024 18:08:03 +0300 Subject: [PATCH 6/6] chore(web): fix docs code preview light/dark style background image isolation --- apps/web/components/code-demo.tsx | 9 ++++----- apps/web/styles/docs.css | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/web/components/code-demo.tsx b/apps/web/components/code-demo.tsx index c07041bce..15faa9a84 100644 --- a/apps/web/components/code-demo.tsx +++ b/apps/web/components/code-demo.tsx @@ -244,12 +244,11 @@ function CodePreview({ children, }: PropsWithChildren<{ view: View; isRTL: boolean; isDarkMode: boolean | null; iframe?: IFrameData }>) { return ( -
+
-
+