From 5c147350eaafe5e32c731e187a1f907d1db93bad Mon Sep 17 00:00:00 2001
From: Daniel Vigaru <22689627+danielvigaru@users.noreply.github.com>
Date: Sun, 2 Feb 2025 01:20:21 +0200
Subject: fix(mobile): margin for "Lists" tab content (#927)
* fix: left margin for list items
* refactor: move type into func definition
* fix: missing return type
Co-authored-by: Joseph Chambers <5374985+imcodingideas@users.noreply.github.com>
* style: remove trailing space
---------
Co-authored-by: Joseph Chambers <5374985+imcodingideas@users.noreply.github.com>
---
apps/mobile/lib/utils.ts | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
(limited to 'apps/mobile/lib/utils.ts')
diff --git a/apps/mobile/lib/utils.ts b/apps/mobile/lib/utils.ts
index 88283f01..bfb6c9ed 100644
--- a/apps/mobile/lib/utils.ts
+++ b/apps/mobile/lib/utils.ts
@@ -5,3 +5,40 @@ import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
+
+/**
+ * Merge props conditionally.
+ *
+ * @example
+ * ```
+ *
+ * ```
+ * results in:
+ * ```
+ *
+ * ```
+ * @example
+ * ```
+ *
+ * ```
+ * results in:
+ * ```
+ *
+ * ```
+ */
+export function condProps(
+ ...condProps: {
+ condition: boolean;
+ props: Record;
+ }[]
+): Record {
+ return condProps.reduce((acc, { condition, props }) => {
+ return condition ? { ...acc, ...props } : acc;
+ }, {});
+}
--
cgit v1.2.3-70-g09d2