simple-merge-class-names 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -21
- package/mergeClassNames.js +20 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ function MyComponent() {
|
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
While using separate strings for each class name can be tedious
|
|
49
|
+
While using separate strings for each class name can be tedious, see [Workflow To Minimize Typing Strain](#workflow-to-minimize-typing-strain), it significantly enhances code readability and Developer Experience (DX). This is in contrast to hard-to-read strings like:
|
|
50
50
|
|
|
51
51
|
```jsx
|
|
52
52
|
function MyComponent() {
|
|
@@ -89,27 +89,9 @@ While similar packages exist (`clsx`) with better features and potentially impro
|
|
|
89
89
|
|
|
90
90
|
```javascript
|
|
91
91
|
/**
|
|
92
|
-
* mergeClassNames -
|
|
93
|
-
|
|
94
|
-
* Example usage: <div className = {mergeClassNames("flex", "flex-col")}/>
|
|
95
|
-
*
|
|
96
|
-
* @license AGPL-3.0
|
|
97
|
-
* Copyright (C) 2025 Abdullah Fatota
|
|
98
|
-
*
|
|
99
|
-
* This program is free software: you can redistribute it and/or modify
|
|
100
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
101
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
102
|
-
* (at your option) any later version.
|
|
103
|
-
*
|
|
104
|
-
* This program is distributed in the hope that it will be useful,
|
|
105
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
106
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
107
|
-
* GNU Affero General Public License for more details.
|
|
108
|
-
*
|
|
109
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
110
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
92
|
+
* mergeClassNames - A straightforward utility for merging CSS class names in React + Tailwind, and other JavaScript projects.
|
|
93
|
+
...
|
|
111
94
|
*/
|
|
112
|
-
|
|
113
95
|
const isDefined = (val) => val !== undefined && val !== null;
|
|
114
96
|
|
|
115
97
|
const isNotEmptyString = (val) => val !== "";
|
package/mergeClassNames.js
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* mergeClassNames -
|
|
3
|
-
*
|
|
4
|
-
* Example usage: <div className = {mergeClassNames("flex", "flex-col")}/>
|
|
2
|
+
* mergeClassNames - A straightforward utility for merging CSS class names in React + Tailwind, and other JavaScript projects.
|
|
5
3
|
*
|
|
6
4
|
* @license AGPL-3.0
|
|
7
5
|
* Copyright (C) 2025 Abdullah Fatota
|
|
8
6
|
*
|
|
7
|
+
* Example usage:
|
|
8
|
+
* import { mergeClassNames } from "simple-merge-class-names";
|
|
9
|
+
*
|
|
10
|
+
* function MyComponent() {
|
|
11
|
+
* return (
|
|
12
|
+
* <div
|
|
13
|
+
* className={mergeClassNames(
|
|
14
|
+
* "app",
|
|
15
|
+
* "min-h-dvh",
|
|
16
|
+
* "grid",
|
|
17
|
+
* "grid-rows-[auto_1fr_auto]",
|
|
18
|
+
* "outline"
|
|
19
|
+
* )}
|
|
20
|
+
* >
|
|
21
|
+
* Hello, world!
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
9
26
|
* This program is free software: you can redistribute it and/or modify
|
|
10
27
|
* it under the terms of the GNU Affero General Public License as published by
|
|
11
28
|
* the Free Software Foundation, either version 3 of the License, or
|
package/package.json
CHANGED