Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web/fixes #1461

Merged
merged 6 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 0 additions & 98 deletions apps/web/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default function DocPage({ params }: Props) {
</ContentLayout>
</main>
<DocsPager doc={doc} />
<DocFooter />
<CarbonAds />
</div>
<ToC doc={doc} />
Expand Down Expand Up @@ -150,103 +149,6 @@ function DocsPager({ doc }: { doc: Doc }) {
);
}

function DocFooter() {
return (
<Footer className="rounded-none pt-16 shadow-none lg:px-0 dark:bg-gray-900">
<div className="w-full">
<div className="grid w-full justify-between md:grid-cols-2">
<div className="mb-4 max-w-sm lg:mb-0">
<Link href="/" className="flex items-center gap-3">
<Image alt="" height="32" src="/favicon.svg" width="32" className="size-8" />
<span className="text-xl font-semibold text-gray-900 dark:text-gray-100">Flowbite React</span>
</Link>
<p className="mb-3 mt-4 max-w-sm text-gray-600 dark:text-gray-400">
Flowbite is an ecosystem built on top of Tailwind CSS including a component library, block sections, a
Figma design system and other resources.
</p>
<p className="mb-3 mt-4 max-w-sm text-gray-600 dark:text-gray-400">
Code licensed{" "}
<a
href="https://github.com/themesberg/flowbite-react/blob/main/LICENSE"
className="text-cyan-600 hover:underline"
>
MIT
</a>
, docs{" "}
<a
href="https://creativecommons.org/licenses/by/3.0/"
rel="nofollow noopener noreferrer"
className="text-cyan-600 hover:underline"
>
CC BY 3.0
</a>
</p>
</div>
<div className="grid grid-cols-2 gap-8 sm:mt-4 sm:grid-cols-3 sm:gap-6">
<div>
<Footer.Title
title="Resources"
className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white"
/>
<Footer.LinkGroup col className="text-gray-600 dark:text-gray-400">
<Footer.Link href="https://github.com/themesberg/flowbite-react" className="text-base">
GitHub
</Footer.Link>
<Footer.Link href="https://flowbite.com/" className="text-base">
Flowbite
</Footer.Link>
<Footer.Link href="https://tailwindcss.com/" className="text-base">
Tailwind CSS
</Footer.Link>
<Footer.Link href="https://flowbite.com/figma/" className="text-base">
Figma
</Footer.Link>
</Footer.LinkGroup>
</div>
<div>
<Footer.Title
title="Help & Support"
className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white"
/>
<Footer.LinkGroup col className="text-gray-600 dark:text-gray-400">
<Footer.Link href="https://discord.gg/4eeurUVvTy" className="text-base">
Discord
</Footer.Link>
<Footer.Link href="https://github.com/themesberg/flowbite-react/discussions" className="text-base">
Github Discussions
</Footer.Link>
</Footer.LinkGroup>
</div>
<div>
<Footer.Title
title="Legal"
className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white"
/>
<Footer.LinkGroup col className="text-gray-600 dark:text-gray-400">
<Footer.Link href="https://flowbite.com/license/" className="text-base">
License
</Footer.Link>
<Footer.Link href="https://flowbite.com/brand/" className="text-base">
Brand guideline
</Footer.Link>
</Footer.LinkGroup>
</div>
</div>
</div>
<Footer.Divider />
<div className="w-full text-center sm:flex sm:items-center sm:justify-center">
<Footer.Copyright
by="All Rights Reserved. Flowbite™ is a registered trademark."
href="/"
year={new Date().getFullYear()}
className="text-base"
/>
</div>
</div>
</Footer>
);
}

function ToC({ doc }: { doc: Doc }) {
return (
<div className="hidden w-64 flex-none px-8 xl:block xl:text-sm">
Expand Down
2 changes: 2 additions & 0 deletions apps/web/app/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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";

Expand All @@ -32,10 +33,11 @@
<div className="relative">
{/* <Banner /> */}
<DocsNavbar {...state} />
<div className="mx-auto w-full max-w-8xl lg:flex lg:px-4">

Check warning on line 36 in apps/web/app/docs/layout.tsx

View workflow job for this annotation

GitHub Actions / 🕵 Lint

Classname 'max-w-8xl' is not a Tailwind CSS class!
<DocsSidebar {...state} />
<div className="w-full min-w-0">{children}</div>
</div>
<MainFooter />
</div>
</div>
);
Expand All @@ -45,7 +47,7 @@
return (
<Navbar
fluid
theme={{

Check warning on line 50 in apps/web/app/docs/layout.tsx

View workflow job for this annotation

GitHub Actions / 🕵 Lint

Classname 'max-w-8xl' is not a Tailwind CSS class!
root: {
base: "sticky top-0 z-[60] mx-auto flex w-full items-center justify-between border-b border-gray-200 bg-white text-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400",
inner: {
Expand Down Expand Up @@ -172,7 +174,7 @@
<Link
href={href}
target={isExternal ? "_blank" : undefined}
className={twMerge(

Check warning on line 177 in apps/web/app/docs/layout.tsx

View workflow job for this annotation

GitHub Actions / 🕵 Lint

Classname 'text-primary-700' is not a Tailwind CSS class!

Check warning on line 177 in apps/web/app/docs/layout.tsx

View workflow job for this annotation

GitHub Actions / 🕵 Lint

Classname 'hover:text-primary-700' is not a Tailwind CSS class!

Check warning on line 177 in apps/web/app/docs/layout.tsx

View workflow job for this annotation

GitHub Actions / 🕵 Lint

Classname 'dark:text-primary-500' is not a Tailwind CSS class!
"flex flex-wrap items-center py-2 font-medium",
pathname === href
? "text-primary-700 hover:text-primary-700 dark:text-primary-500"
Expand Down
3 changes: 1 addition & 2 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Banner } from "~/components/banner";
import {
ComponentsSection,
ContributorsSection,
Expand All @@ -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 (
Expand Down
8 changes: 5 additions & 3 deletions apps/web/components/homepage/contributors-section.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,9 +12,11 @@ interface Contributor {

async function fetchContributors(): Promise<Contributor[]> {
try {
const result = await fetch("https://api.github.com/repos/themesberg/flowbite-react/contributors?per_page=21");
const result = await fetchSafe<Contributor[]>(
"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 [];
}
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/homepage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
6 changes: 1 addition & 5 deletions apps/web/components/homepage/social-proof-section.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import Image from "next/image";
import { safeResJson } from "~/helpers/http";

async function fetchSafe<T>(endpoint: string): Promise<T> {
return safeResJson(await fetch(endpoint));
}
import { fetchSafe } from "~/helpers/http";

async function fetchStargazers(): Promise<string> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export function MainFooter() {
Code licensed{" "}
<a
href="https://github.com/themesberg/flowbite-react/blob/main/LICENSE"
rel="nofollow noopener noreferrer"
target="_blank"
className="text-cyan-600 hover:underline"
>
MIT
Expand All @@ -28,6 +30,7 @@ export function MainFooter() {
<a
href="https://creativecommons.org/licenses/by/3.0/"
rel="nofollow noopener noreferrer"
target="_blank"
className="text-cyan-600 hover:underline"
>
CC BY 3.0
Expand All @@ -41,16 +44,26 @@ export function MainFooter() {
className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white"
/>
<Footer.LinkGroup col className="text-gray-600 dark:text-gray-400">
<Footer.Link href="https://github.com/themesberg/flowbite-react" className="text-base">
<Footer.Link
href="https://github.com/themesberg/flowbite-react"
rel="noopener"
target="_blank"
className="text-base"
>
GitHub
</Footer.Link>
<Footer.Link href="https://flowbite.com/" className="text-base">
<Footer.Link href="https://flowbite.com/" rel="noopener" target="_blank" className="text-base">
Flowbite
</Footer.Link>
<Footer.Link href="https://tailwindcss.com/" className="text-base">
<Footer.Link
href="https://tailwindcss.com/"
rel="nofollow noopener noreferrer"
target="_blank"
className="text-base"
>
Tailwind CSS
</Footer.Link>
<Footer.Link href="https://flowbite.com/figma/" className="text-base">
<Footer.Link href="https://flowbite.com/figma/" rel="noopener" target="_blank" className="text-base">
Figma
</Footer.Link>
</Footer.LinkGroup>
Expand All @@ -61,10 +74,20 @@ export function MainFooter() {
className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white"
/>
<Footer.LinkGroup col className="text-gray-600 dark:text-gray-400">
<Footer.Link href="https://discord.gg/4eeurUVvTy" className="text-base">
<Footer.Link
href="https://discord.gg/4eeurUVvTy"
rel="nofollow noopener noreferrer"
target="_blank"
className="text-base"
>
Discord
</Footer.Link>
<Footer.Link href="https://github.com/themesberg/flowbite-react/discussions" className="text-base">
<Footer.Link
href="https://github.com/themesberg/flowbite-react/discussions"
rel="noopener"
target="_blank"
className="text-base"
>
Github Discussions
</Footer.Link>
</Footer.LinkGroup>
Expand All @@ -75,10 +98,10 @@ export function MainFooter() {
className="mb-6 text-sm font-semibold uppercase text-gray-900 dark:text-white"
/>
<Footer.LinkGroup col className="text-gray-600 dark:text-gray-400">
<Footer.Link href="https://flowbite.com/license/" className="text-base">
<Footer.Link href="https://flowbite.com/license/" rel="noopener" target="_blank" className="text-base">
License
</Footer.Link>
<Footer.Link href="https://flowbite.com/brand/" className="text-base">
<Footer.Link href="https://flowbite.com/brand/" rel="noopener" target="_blank" className="text-base">
Brand guideline
</Footer.Link>
</Footer.LinkGroup>
Expand Down
10 changes: 7 additions & 3 deletions apps/web/helpers/http.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export function safeResJson<T>(res: Response) {
if (res.ok) return res.json() as Promise<T>;
export async function fetchSafe<T>(endpoint: string): Promise<T> {
const response = await fetch(endpoint);

throw new Error("Internal server error!");
if (!response.ok) {
throw new Error("Internal server error!");
}

return response.json();
}
SutuSebastian marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 6 additions & 6 deletions packages/ui/src/components/Datepicker/Datepicker.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Datepicker value={testDate.getTime()} />);
render(<Datepicker defaultDate={testDate} />);

const textBox = screen.getByRole("textbox");
await userEvent.click(textBox);
Expand All @@ -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(<Datepicker value={testDate.getTime()} maxDate={testDate} />);
render(<Datepicker defaultDate={testDate} maxDate={testDate} />);

const textBox = screen.getByRole("textbox");
await userEvent.click(textBox);
Expand All @@ -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(<Datepicker value={testDate.getTime()} maxDate={testDate} />);
render(<Datepicker defaultDate={testDate} maxDate={testDate} />);

const textBox = screen.getByRole("textbox");
await userEvent.click(textBox);
Expand All @@ -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(<Datepicker value={testDate.getTime()} minDate={testDate} />);
render(<Datepicker defaultDate={testDate} minDate={testDate} />);

const textBox = screen.getByRole("textbox");
await userEvent.click(textBox);
Expand All @@ -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(<Datepicker value={testDate.getTime()} minDate={testDate} />);
render(<Datepicker defaultDate={testDate} minDate={testDate} />);

const textBox = screen.getByRole("textbox");
await userEvent.click(textBox);
Expand All @@ -167,7 +167,7 @@ describe("Components / Datepicker", () => {
const maxDate = new Date(2030, 1, 1);
const testDate = new Date(2024, 6, 1);

render(<Datepicker value={testDate.getTime()} minDate={minDate} maxDate={maxDate} />);
render(<Datepicker defaultDate={testDate} minDate={minDate} maxDate={maxDate} />);

const textBox = screen.getByRole("textbox");
await userEvent.click(textBox);
Expand Down
Loading