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.

feat: responsiveness adjustments

flooorianflo6aab40f75ed2
diff --git a/apps/web/ui/analytics/date-range-picker.tsx b/apps/web/ui/analytics/date-range-picker.tsx
index c70637b30a..3cabefe907 100644
--- a/apps/web/ui/analytics/date-range-picker.tsx
+++ b/apps/web/ui/analytics/date-range-picker.tsx
@@ -93,7 +93,7 @@ export default function DateRangePicker() {
className={cn(
"flex w-full items-center justify-between space-x-2 truncate rounded-md border border-gray-200 bg-white px-3 py-2.5 transition-all md:w-48",
{
- "border-gray-500 ring-4 ring-gray-200": openDatePopover,
+ "truncate border-gray-500 ring-4 ring-gray-200": openDatePopover,
},
)}
>
@@ -102,7 +102,7 @@ export default function DateRangePicker() {
icon={<Calendar className="h-4 w-4 flex-shrink-0" />}
/>
<ChevronDown
- className={`h-4 w-4 text-gray-400 ${
+ className={`h-4 w-4 flex-shrink-0 text-gray-400 ${
openDatePopover ? "rotate-180 transform" : ""
} transition-all duration-75`}
/>
diff --git a/apps/web/ui/analytics/domain-selector.tsx b/apps/web/ui/analytics/domain-selector.tsx
index a24b5f6b69..89c9e5dd16 100644
--- a/apps/web/ui/analytics/domain-selector.tsx
+++ b/apps/web/ui/analytics/domain-selector.tsx
@@ -12,12 +12,15 @@ export default function DomainSelector() {
const searchParams = useSearchParams();
const selectedDomainId = searchParams?.get("domainId");
+ console.log(domains);
+
return domains && domains.length > 0 ? (
<InputSelect
adjustForMobile
items={domains.map(({ id, slug }) => ({
id,
value: slug,
+ image: `${GOOGLE_FAVICON_URL}${slug}`,
}))}
icon={<Globe className="h-4 w-4 text-black" />}
selectedItem={{
@@ -30,14 +33,14 @@ export default function DomainSelector() {
: undefined,
}}
setSelectedItem={(domain) => {
- if (domain && typeof domain !== "function" && domain.id)
+ if (domain && typeof domain !== "function" && domain.id) {
router.push(
queryParams({
set: { domainId: domain.id },
getNewPath: true,
}) as string,
);
- else
+ } else
router.push(
queryParams({ del: "domainId", getNewPath: true }) as string,
);
diff --git a/apps/web/ui/analytics/filter-bar.tsx b/apps/web/ui/analytics/filter-bar.tsx
index 2f0b6bb34e..d5e082f169 100644
--- a/apps/web/ui/analytics/filter-bar.tsx
+++ b/apps/web/ui/analytics/filter-bar.tsx
@@ -6,7 +6,7 @@ import useDomains from "@/lib/swr/use-domains";
export default function FilterBar() {
const { allDomains } = useDomains();
return (
- <div className="flex w-auto gap-1 rounded-lg bg-gray-100 p-1">
+ <div className="flex w-full gap-1 rounded-lg bg-gray-100 p-1 min-[550px]:w-auto">
{allDomains.length > 0 && <DomainSelector />}
<TagSelector />
{/* <button className="flex items-center justify-center gap-2 truncate rounded-md border border-gray-300 bg-white py-2 pl-2 pr-4 text-sm text-gray-400 sm:border-gray-200">
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index 50d7f1fb78..722653b0a4 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -48,14 +48,21 @@ export default function Toggle() {
>
<div
className={cn(
- "mx-auto flex w-full max-w-4xl flex-col gap-2 space-y-3 px-2.5 md:space-y-0 lg:px-0 ",
+ "mx-auto flex w-full max-w-4xl flex-col gap-2 space-y-3 px-2.5 md:space-y-0 lg:px-0",
{
- // "md:h-24": !key,
"md:h-10": key,
},
)}
>
- <div className="flex w-full items-center justify-between gap-2">
+ <div
+ className={cn(
+ "flex w-full flex-col items-center justify-between gap-2 md:flex-row",
+ {
+ "flex-col md:flex-row": !key,
+ "items-center": key,
+ },
+ )}
+ >
{isPublicStatsPage ? (
<a
className="group flex items-center text-lg font-semibold text-gray-800"
@@ -93,11 +100,23 @@ export default function Toggle() {
</h2>
</div>
)}
- <div className="flex items-center gap-2">
+ <div
+ className={cn("flex items-center gap-2", {
+ "flex-col min-[550px]:flex-row": !key,
+ "w-full md:w-auto": key,
+ })}
+ >
{!isPublicStatsPage && !key && <FilterBar />}
{!isPublicStatsPage && key && <SharePopover />}
- <DateRangePicker />
- {!isPublicStatsPage && <ExportButton />}
+ <div
+ className={cn("flex w-full items-center gap-2", {
+ "min-[550px]:w-auto": !key,
+ "justify-end": key,
+ })}
+ >
+ <DateRangePicker />
+ {!isPublicStatsPage && <ExportButton />}
+ </div>
</div>
</div>
{/* <div className="flex w-full">
diff --git a/packages/ui/src/icon-menu.tsx b/packages/ui/src/icon-menu.tsx
index 3b4fbded70..98af015ab5 100644
--- a/packages/ui/src/icon-menu.tsx
+++ b/packages/ui/src/icon-menu.tsx
@@ -7,9 +7,9 @@ interface MenuIconProps {
export function IconMenu({ icon, text }: MenuIconProps) {
return (
- <div className="flex items-center justify-start space-x-2">
+ <div className="flex items-center justify-start space-x-2 truncate">
{icon}
- <p className="text-sm">{text}</p>
+ <p className="truncate text-sm">{text}</p>
</div>
);
}
diff --git a/packages/ui/src/input-select.tsx b/packages/ui/src/input-select.tsx
index f77a5ecc4e..7280cd2084 100644
--- a/packages/ui/src/input-select.tsx
+++ b/packages/ui/src/input-select.tsx
@@ -152,7 +152,7 @@ export function InputSelect({
<Command ref={commandRef} className="relative" loop>
<div
className={cn(
- "group relative min-w-[140px] rounded-md border border-gray-300 bg-white px-1 focus-within:border-gray-500 focus-within:ring-1 focus-within:ring-gray-500",
+ "group relative rounded-md border border-gray-300 bg-white px-1 focus-within:border-gray-500 focus-within:ring-1 focus-within:ring-gray-500 md:min-w-[140px]",
className,
)}
>