From 5726f6955ca802813ca17dc73889ada9807e7867 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:21:47 +0530 Subject: [PATCH] dev: added tailwind merge helper function (#2844) --- space/helpers/common.helper.ts | 7 ++++++- space/package.json | 6 +++--- web/helpers/common.helper.ts | 5 +++++ web/package.json | 2 ++ yarn.lock | 16 +++++++++++++++- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/space/helpers/common.helper.ts b/space/helpers/common.helper.ts index 758d7c370..7c3d14157 100644 --- a/space/helpers/common.helper.ts +++ b/space/helpers/common.helper.ts @@ -1 +1,6 @@ -export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ? process.env.NEXT_PUBLIC_API_BASE_URL : ""; +import { clsx, type ClassValue } from "clsx"; +import { twMerge } from "tailwind-merge"; + +export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? ""; + +export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs)); \ No newline at end of file diff --git a/space/package.json b/space/package.json index 20e888c8d..ddab959ab 100644 --- a/space/package.json +++ b/space/package.json @@ -17,9 +17,9 @@ "@emotion/styled": "^11.11.0", "@headlessui/react": "^1.7.13", "@mui/material": "^5.14.1", - "@plane/ui": "*", "@plane/lite-text-editor": "*", "@plane/rich-text-editor": "*", + "@plane/ui": "*", "@plane/document-editor": "*", "axios": "^1.3.4", "clsx": "^2.0.0", @@ -36,7 +36,7 @@ "react-dom": "^18.2.0", "react-hook-form": "^7.38.0", "swr": "^2.2.2", - "tailwind-merge": "^1.14.0", + "tailwind-merge": "^2.0.0", "typescript": "4.9.5", "uuid": "^9.0.0" }, @@ -44,7 +44,7 @@ "@types/js-cookie": "^3.0.3", "@types/node": "18.14.1", "@types/nprogress": "^0.2.0", - "@types/react": "18.0.28", + "@types/react": "18.2.35", "@types/react-dom": "18.0.11", "@types/uuid": "^9.0.1", "@typescript-eslint/eslint-plugin": "^5.48.2", diff --git a/web/helpers/common.helper.ts b/web/helpers/common.helper.ts index ed199fed4..9999b3274 100644 --- a/web/helpers/common.helper.ts +++ b/web/helpers/common.helper.ts @@ -1,3 +1,6 @@ +import { clsx, type ClassValue } from "clsx"; +import { twMerge } from "tailwind-merge"; + export const debounce = (func: any, wait: number, immediate: boolean = false) => { let timeout: any; @@ -18,3 +21,5 @@ export const debounce = (func: any, wait: number, immediate: boolean = false) => }; export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ? process.env.NEXT_PUBLIC_API_BASE_URL : ""; + +export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs)); diff --git a/web/package.json b/web/package.json index 7912cb565..23ed714ea 100644 --- a/web/package.json +++ b/web/package.json @@ -31,6 +31,7 @@ "@types/lodash.debounce": "^4.0.7", "@types/react-datepicker": "^4.8.0", "axios": "^1.1.3", + "clsx": "^2.0.0", "cmdk": "^0.2.0", "date-fns": "^2.30.0", "dotenv": "^16.0.3", @@ -55,6 +56,7 @@ "react-popper": "^2.3.0", "sharp": "^0.32.1", "swr": "^2.1.3", + "tailwind-merge": "^2.0.0", "uuid": "^9.0.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index d54b04b63..285df96a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -926,6 +926,13 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.23.1": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.4.tgz#36fa1d2b36db873d25ec631dcc4923fdc1cf2e2e" + integrity sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.22.15", "@babel/template@^7.22.5": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" @@ -2804,7 +2811,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@18.0.28", "@types/react@18.2.0", "@types/react@^18.2.35", "@types/react@^18.2.37", "@types/react@^18.2.5": +"@types/react@*", "@types/react@18.2.0", "@types/react@18.2.35", "@types/react@^18.2.35", "@types/react@^18.2.37", "@types/react@^18.2.5": version "18.2.0" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.0.tgz#15cda145354accfc09a18d2f2305f9fc099ada21" integrity sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA== @@ -8171,6 +8178,13 @@ tailwind-merge@^1.14.0: resolved "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-1.14.0.tgz#e677f55d864edc6794562c63f5001f45093cdb8b" integrity sha512-3mFKyCo/MBcgyOTlrY8T7odzZFx+w+qKSMAmdFzRvqBfLlSigU6TZnlFHK0lkMwj9Bj8OYU+9yW9lmGuS0QEnQ== +tailwind-merge@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-2.0.0.tgz#a0f3a8c874ebae5feec5595614d08245a5f88a39" + integrity sha512-WO8qghn9yhsldLSg80au+3/gY9E4hFxIvQ3qOmlpXnqpDKoMruKfi/56BbbMg6fHTQJ9QD3cc79PoWqlaQE4rw== + dependencies: + "@babel/runtime" "^7.23.1" + tailwindcss-animate@^1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/tailwindcss-animate/-/tailwindcss-animate-1.0.7.tgz#318b692c4c42676cc9e67b19b78775742388bef4"