Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

add mobile text variant for AnnouncementBadge (#38602)

Alan Daniel7676cf44686b
diff --git a/apps/www/components/Announcement/Badge.tsx b/apps/www/components/Announcement/Badge.tsx
index 19e1539bca3..052088e3e7e 100644
--- a/apps/www/components/Announcement/Badge.tsx
+++ b/apps/www/components/Announcement/Badge.tsx
@@ -6,6 +6,8 @@ import { ChevronRightIcon } from 'lucide-react'
interface Props {
url: string
announcement: string | ReactNode
+ /* Text or node to display on mobile */
+ announcementMobile?: string | ReactNode
badge?: string | ReactNode
target?: '_self' | '_blank' | string
className?: string
@@ -16,6 +18,7 @@ interface Props {
const AnnouncementBadge = ({
url,
announcement,
+ announcementMobile,
badge,
target = '_self',
className,
@@ -56,7 +59,20 @@ const AnnouncementBadge = ({
{badge}
</Badge>
)}
- <span className="text-foreground announcement-text">{announcement}</span>
+ <span
+ className={cn('text-foreground announcement-text line-clamp-1 w-full', {
+ // only hide if announcementMobile is provided
+ 'hidden md:[display:-webkit-box]': announcementMobile,
+ })}
+ >
+ {announcement}
+ </span>
+ {announcementMobile && (
+ <span className="text-foreground announcement-text-mobile md:hidden line-clamp-1">
+ {announcementMobile}
+ </span>
+ )}
+
{hasArrow && (
<ChevronRightIcon className="announcement-icon h-4 ml-2 -translate-x-1 text-foreground transition-transform group-hover/announcement:translate-x-0" />
)}
diff --git a/apps/www/components/Hero/Hero.tsx b/apps/www/components/Hero/Hero.tsx
index 8a342a8f546..40029b7d137 100644
--- a/apps/www/components/Hero/Hero.tsx
+++ b/apps/www/components/Hero/Hero.tsx
@@ -18,6 +18,7 @@ const Hero = () => {
<AnnouncementBadge
url="/events/migrating-from-firebase-mobbin"
announcement="Looking to migrate to Supabase? Sign up for our webinar and learn how"
+ announcementMobile="Learn how to migrate to Supabase"
/>
<div className="flex flex-col items-center">