Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add WIP news cards

Tim Wilson0be3e5386833
diff --git a/apps/web/ui/layout/sidebar/news.tsx b/apps/web/ui/layout/sidebar/news.tsx
new file mode 100644
index 0000000000..919c1d0ad6
--- /dev/null
+++ b/apps/web/ui/layout/sidebar/news.tsx
@@ -0,0 +1,53 @@
+import { CSSProperties } from "react";
+
+export function News() {
+ const cardCount = 5;
+
+ return (
+ <div className="p-3">
+ <div className="relative size-full">
+ {[...Array(cardCount - 1)].map((_, idx) => (
+ <div
+ className="absolute left-0 top-0 translate-y-[var(--y)] scale-x-[var(--scale)]"
+ style={
+ {
+ "--y": `-${(cardCount - 1 - idx) * 5}%`,
+ "--scale": 1 - 0.4 / idx / cardCount,
+ } as CSSProperties
+ }
+ >
+ <NewsCard
+ key={idx}
+ title="Title Title"
+ description="Description of the article that clicking this card will take you to"
+ />
+ </div>
+ ))}
+ <NewsCard
+ title="Title Title"
+ description="Description of the article that clicking this card will take you to"
+ />
+ </div>
+ </div>
+ );
+}
+
+function NewsCard({
+ title,
+ description,
+}: {
+ title: string;
+ description: string;
+}) {
+ return (
+ <div className="relative flex items-center gap-2 rounded-lg border border-neutral-200 bg-white p-2 text-xs">
+ <div className="h-9 w-12 shrink-0 rounded-md bg-neutral-200" />
+ <div className="flex flex-col gap-1">
+ <span className="line-clamp-1 font-medium text-neutral-900">
+ {title}
+ </span>
+ <p className="line-clamp-2 text-neutral-500">{description}</p>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index f612b7db6e..6fcd644c61 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -13,6 +13,7 @@ import {
} from "react";
import UserSurveyButton from "../user-survey";
import { ITEMS, type NavItem as NavItemType } from "./items";
+import { News } from "./news";
import { Usage } from "./usage";
import UserDropdown from "./user-dropdown";
import { WorkspaceDropdown } from "./workspace-dropdown";
@@ -97,6 +98,7 @@ export function SidebarNav({ toolContent }: { toolContent?: ReactNode }) {
</div>
</nav>
<div className="relative mt-6 flex grow flex-col justify-end">
+ <News />
<UserSurveyButton />
<Usage />
</div>