Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

refactor: update HeroSection layout and introduce responsive CTA comp… (#126)

Vlad Sazonauca274f5824f4
diff --git a/e2e/about.test.ts b/e2e/about.test.ts
index 6bbf8d6..55b4d05 100644
--- a/e2e/about.test.ts
+++ b/e2e/about.test.ts
@@ -45,7 +45,9 @@ test.describe("About page", () => {
).toBeVisible();
await expect(
- heroSection.getByText("No sign-up required. 100% free and open-source.")
+ heroSection
+ .getByText("No sign-up required. 100% free and open-source.")
+ .filter({ visible: true })
).toBeVisible();
const video = heroSection.getByTestId("hero-about-page-video");
@@ -284,9 +286,9 @@ test.describe("About page", () => {
).toBeVisible();
await expect(
- heroSection.getByText(
- "Aucune inscription requise. 100% gratuit et open-source."
- )
+ heroSection
+ .getByText("Aucune inscription requise. 100% gratuit et open-source.")
+ .filter({ visible: true })
).toBeVisible();
// Check Features section in French
@@ -403,9 +405,11 @@ test.describe("About page", () => {
).toBeVisible();
await expect(
- heroSection.getByText(
- "Keine Anmeldung erforderlich. 100% kostenlos und Open-Source."
- )
+ heroSection
+ .getByText(
+ "Keine Anmeldung erforderlich. 100% kostenlos und Open-Source."
+ )
+ .filter({ visible: true })
).toBeVisible();
// Check Features section in German
diff --git a/e2e/stripe-invoice-template/share-logic.test.ts b/e2e/stripe-invoice-template/share-logic.test.ts
index ca3beb7..3527720 100644
--- a/e2e/stripe-invoice-template/share-logic.test.ts
+++ b/e2e/stripe-invoice-template/share-logic.test.ts
@@ -56,7 +56,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
const shareButton = page.getByRole("button", {
name: "Generate a link to invoice",
});
- await expect(shareButton).toHaveAttribute("aria-disabled", "true");
+ await expect(shareButton).toHaveAttribute("data-disabled", "true");
// click over share button to verify tooltip
// on mobile, we need to click the button to show the toast because it's better UX for user (you can't hover on mobile)
@@ -114,7 +114,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
const shareButton = page.getByRole("button", {
name: "Generate a link to invoice",
});
- await expect(shareButton).toHaveAttribute("aria-disabled", "true");
+ await expect(shareButton).toHaveAttribute("data-disabled", "true");
// Remove the logo
await generalInfoSection
@@ -127,7 +127,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
).toBeHidden();
// Verify share button is enabled again
- await expect(shareButton).toHaveAttribute("aria-disabled", "false");
+ await expect(shareButton).toHaveAttribute("data-disabled", "false");
await expect(shareButton).toBeEnabled();
// Test that sharing works
@@ -176,7 +176,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
}, SMALL_TEST_IMAGE_BASE64);
// Verify share button becomes disabled
- await expect(shareButton).toHaveAttribute("aria-disabled", "true");
+ await expect(shareButton).toHaveAttribute("data-disabled", "true");
// Switch back to default template
await page
@@ -184,7 +184,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
.selectOption("default");
// Verify share button is enabled again (logo is cleared when switching away from Stripe)
- await expect(shareButton).toHaveAttribute("aria-disabled", "false");
+ await expect(shareButton).toHaveAttribute("data-disabled", "false");
await expect(shareButton).toBeEnabled();
});
@@ -207,7 +207,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
});
// Verify share button is disabled
- await expect(shareButton).toHaveAttribute("aria-disabled", "true");
+ await expect(shareButton).toHaveAttribute("data-disabled", "true");
// Wait a moment for any debounced localStorage updates
// eslint-disable-next-line playwright/no-wait-for-timeout
@@ -238,7 +238,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
).toBeVisible();
// Verify share button is still disabled
- await expect(shareButton).toHaveAttribute("aria-disabled", "true");
+ await expect(shareButton).toHaveAttribute("data-disabled", "true");
});
test("sharing functionality works correctly in mobile view (mobile UI is a bit different)", async ({
@@ -263,7 +263,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
await page.evaluate(uploadBase64LogoAsFile, SMALL_TEST_IMAGE_BASE64);
// Verify share button is disabled in mobile view too
- await expect(shareButton).toHaveAttribute("aria-disabled", "true");
+ await expect(shareButton).toHaveAttribute("data-disabled", "true");
// Click share button to verify toast is shown
// eslint-disable-next-line playwright/no-force-option
@@ -285,7 +285,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {
.getByRole("button", { name: "Remove logo" })
.click();
- await expect(shareButton).toHaveAttribute("aria-disabled", "false");
+ await expect(shareButton).toHaveAttribute("data-disabled", "false");
await expect(shareButton).toBeEnabled();
});
});
diff --git a/src/app/(app)/components/index.tsx b/src/app/(app)/components/index.tsx
index a88e609..388163d 100644
--- a/src/app/(app)/components/index.tsx
+++ b/src/app/(app)/components/index.tsx
@@ -152,7 +152,7 @@ export function InvoiceClientPage({
className={cn(!canShareInvoice && "bg-red-50")}
trigger={
<Button
- aria-disabled={!canShareInvoice} // for better UX than 'disabled'
+ data-disabled={!canShareInvoice} // for better UX than 'disabled'
onClick={handleShareInvoice}
_variant="outline"
className={cn("mx-2 w-full")}
diff --git a/src/app/(app)/page.client.tsx b/src/app/(app)/page.client.tsx
index c0282c3..96b8938 100644
--- a/src/app/(app)/page.client.tsx
+++ b/src/app/(app)/page.client.tsx
@@ -423,7 +423,7 @@ export function AppPageClient() {
className={cn(!canShareInvoice && "bg-red-50")}
trigger={
<Button
- aria-disabled={!canShareInvoice} // better UX than 'disabled'
+ data-disabled={!canShareInvoice} // better UX than 'disabled'
onClick={handleShareInvoice}
_variant="outline"
className={cn(
diff --git a/src/app/[locale]/about/page.tsx b/src/app/[locale]/about/page.tsx
index ab5e1de..440d2b2 100644
--- a/src/app/[locale]/about/page.tsx
+++ b/src/app/[locale]/about/page.tsx
@@ -200,7 +200,7 @@ function HeroSection() {
</div>
<div className="container relative z-10 px-4 md:px-6">
- <div className="grid gap-8 lg:grid-cols-2 lg:gap-12 xl:gap-6">
+ <div className="grid gap-6 md:gap-8 lg:grid-cols-2 lg:gap-12 xl:gap-6">
{/* Left column (text) */}
<div className="flex flex-col justify-center space-y-5 md:space-y-6">
<div className="space-y-3 md:space-y-4">
@@ -234,12 +234,7 @@ function HeroSection() {
</Link>
</Button>
</div>
- <div className="mx-auto flex max-w-fit cursor-pointer items-center justify-center gap-x-2 text-pretty rounded-full border border-amber-300 bg-amber-50 px-4 py-1.5 text-sm font-medium text-amber-800 shadow-sm transition-all hover:scale-105 sm:mx-0">
- <span className="" role="img" aria-label="checkmark">
- ✅
- </span>
- <span>{t("hero.noSignup")}</span>
- </div>
+ <CtaTextDesktop text={t("hero.noSignup")} />
</div>
{/* Right column (video) */}
@@ -266,12 +261,52 @@ function HeroSection() {
</div>
</div>
</div>
+
+ <CtaTextMobile text={t("hero.noSignup")} />
</div>
</div>
</section>
);
}
+// should be hidden on desktop
+function CtaTextMobile({
+ text = "No sign-up required. 100% free and open-source.",
+}: {
+ text: string;
+}) {
+ return (
+ <div
+ className="mx-auto flex max-w-fit cursor-pointer items-center justify-center gap-x-2 text-pretty rounded-full border border-amber-300 bg-amber-50 px-4 py-1.5 text-sm font-medium text-amber-800 shadow-sm transition-all hover:scale-105 lg:hidden"
+ data-testid="cta-text-mobile"
+ >
+ <span className="" role="img" aria-label="checkmark">
+ ✅
+ </span>
+ <span>{text}</span>
+ </div>
+ );
+}
+
+// should be hidden on mobile
+function CtaTextDesktop({
+ text = "No sign-up required. 100% free and open-source.",
+}: {
+ text: string;
+}) {
+ return (
+ <div
+ className="mx-auto hidden max-w-fit cursor-pointer items-center justify-center gap-x-2 text-pretty rounded-full border border-amber-300 bg-amber-50 px-4 py-1.5 text-sm font-medium text-amber-800 shadow-sm transition-all hover:scale-105 sm:mx-0 lg:flex"
+ data-testid="cta-text-desktop"
+ >
+ <span className="" role="img" aria-label="checkmark">
+ ✅
+ </span>
+ <span>{text}</span>
+ </div>
+ );
+}
+
function FeaturesSection() {
const t = useTranslations("About");
@@ -308,7 +343,7 @@ function FeaturesSection() {
return (
<section
id="features"
- className="flex w-full items-center justify-center bg-slate-50 py-12 lg:py-20"
+ className="flex w-full items-center justify-center bg-slate-50 py-4 lg:py-8 xl:py-16"
>
<div className="container px-4 md:px-6">
<div className="flex flex-col items-center justify-center space-y-4 text-center">
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index 16ce807..04644fd 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -5,7 +5,7 @@ import * as React from "react";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
- "inline-flex items-center justify-center whitespace-nowrap rounded-lg text-sm font-medium transition-colors outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:shrink-0 [&[aria-disabled=true]]:opacity-50",
+ "inline-flex items-center justify-center whitespace-nowrap rounded-lg text-sm font-medium transition-colors outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:shrink-0 [&[data-disabled=true]]:opacity-50",
{
variants: {
_variant: {