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.

fix: scrollability in tags popover

flooorianflof2520d3e8d2e
diff --git a/apps/web/styles/globals.css b/apps/web/styles/globals.css
index c3b1377a34..731b7c37a6 100644
--- a/apps/web/styles/globals.css
+++ b/apps/web/styles/globals.css
@@ -29,3 +29,23 @@
@apply rounded-lg;
}
}
+
+/* Implement a custom scrollbar to preventing ugly looking scroll-overflows */
+.dub-scrollbar {
+ scrollbar-width: auto;
+ scrollbar-color: #d1d5db #ffffff;
+}
+
+.dub-scrollbar::-webkit-scrollbar {
+ width: 8px;
+ height: 8px;
+}
+
+.dub-scrollbar::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.dub-scrollbar::-webkit-scrollbar-thumb {
+ background-color: #d1d5db;
+ border-radius: 10px;
+}
diff --git a/apps/web/ui/analytics/tag-selector.tsx b/apps/web/ui/analytics/tag-selector.tsx
index 75ff06562f..20e3d5d404 100644
--- a/apps/web/ui/analytics/tag-selector.tsx
+++ b/apps/web/ui/analytics/tag-selector.tsx
@@ -17,34 +17,26 @@ export default function TagSelector() {
const [openPopover, setOpenPopover] = useState(false);
const [filterValue, setFilterValue] = useState("");
- // filter the tags through the search input
- const filteredTags = tags
- ? tags!.filter((tag) =>
- tag.name.toLowerCase().includes(filterValue.toLowerCase()),
- )
- : [];
-
return tags && tags.length > 0 ? (
<Popover
content={
<Command>
<div className="grid w-full p-2 md:w-48">
- {tags.length > 10 && (
+ {tags.length > 4 && (
<div className="relative mb-2">
- <div className="pointer-events-none absolute inset-y-0 left-3.5 flex items-center">
+ <div className="pointer-events-none absolute inset-y-0 left-3 flex items-center">
<Search className="h-4 w-4 text-gray-400" />
</div>
-
<Command.Input
value={filterValue}
autoFocus
onValueChange={(search: string) => setFilterValue(search)}
- placeholder="Filter tags..."
- className="w-full rounded-md border border-gray-300 py-1.5 pl-10 text-black placeholder:text-gray-400 focus:border-black focus:outline-none focus:ring-gray-600 sm:text-sm"
+ placeholder="Filter tags"
+ className="w-full rounded-md border border-gray-300 py-1.5 pl-9 text-black placeholder:text-gray-400 focus:border-black focus:outline-none focus:ring-0 focus:ring-gray-600 sm:text-sm"
/>
</div>
)}
- <Command.List className="max-h-96 overflow-y-scroll">
+ <Command.List className="dub-scrollbar max-h-96 overflow-y-auto">
{/* All tags selection should be shown all the time */}
<Link
href={
@@ -60,23 +52,27 @@ export default function TagSelector() {
<Tick className="h-4 w-4" aria-hidden="true" />
)}
</Link>
- {filteredTags.map((tag) => (
- <Link
- key={tag.id}
- href={
- queryParams({
- set: { tagId: tag.id },
- getNewPath: true,
- }) as string
- }
- className="flex w-full items-center justify-between space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200"
- >
- <TagBadge {...tag} />
- {selectedTagId === tag.id && (
- <Tick className="h-4 w-4" aria-hidden="true" />
- )}
- </Link>
- ))}
+ {tags
+ .filter((tag) =>
+ tag.name.toLowerCase().includes(filterValue.toLowerCase()),
+ )
+ .map((tag) => (
+ <Link
+ key={tag.id}
+ href={
+ queryParams({
+ set: { tagId: tag.id },
+ getNewPath: true,
+ }) as string
+ }
+ className="flex w-full items-center justify-between space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200"
+ >
+ <TagBadge {...tag} />
+ {selectedTagId === tag.id && (
+ <Tick className="h-4 w-4" aria-hidden="true" />
+ )}
+ </Link>
+ ))}
</Command.List>
</div>
</Command>