@melcanz85/chaincss 1.10.1 → 1.11.0
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 +18 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,6 @@ ChainCSS is a revolutionary CSS-in-JS solution that gives you **two powerful mod
|
|
|
54
54
|
**in your main.jcss**
|
|
55
55
|
|
|
56
56
|
```javascript
|
|
57
|
-
// src/main.jcss
|
|
58
57
|
<@
|
|
59
58
|
const button = get('./button.jcss');
|
|
60
59
|
|
|
@@ -83,44 +82,27 @@ OR with vanilla nodejs project
|
|
|
83
82
|
**Perfect for:** Dynamic styles that respond to props, state, or themes.
|
|
84
83
|
|
|
85
84
|
```jsx
|
|
86
|
-
|
|
87
|
-
import {
|
|
85
|
+
// components/DynamicButton.jsx
|
|
86
|
+
import { useChainStyles } from '@melcanz85/chaincss';
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const styles = useChainStyles(() => ({
|
|
95
|
-
buttonGroup: $()
|
|
96
|
-
.display('flex')
|
|
97
|
-
.gap('1rem')
|
|
98
|
-
.justifyContent('center')
|
|
99
|
-
.marginTop('2rem')
|
|
100
|
-
.flexWrap('wrap')
|
|
101
|
-
.block(),
|
|
102
|
-
|
|
103
|
-
variantButton: $()
|
|
88
|
+
function DynamicButton({ variant = 'primary', children }) {
|
|
89
|
+
const styles = useChainStyles({
|
|
90
|
+
button: () => $()
|
|
91
|
+
.backgroundColor(variant === 'primary' ? '#667eea' : '#48bb78')
|
|
92
|
+
.color('white')
|
|
104
93
|
.padding('0.5rem 1rem')
|
|
105
|
-
.
|
|
106
|
-
.border('none')
|
|
107
|
-
.borderRadius('0.375rem')
|
|
108
|
-
.cursor('pointer')
|
|
109
|
-
.fontWeight('500')
|
|
110
|
-
.transition('all 0.2s')
|
|
94
|
+
.borderRadius('4px')
|
|
111
95
|
.hover()
|
|
112
|
-
.
|
|
96
|
+
.transform('translateY(-2px)')
|
|
97
|
+
.boxShadow('0 4px 6px rgba(0,0,0,0.1)')
|
|
113
98
|
.block()
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default SectionDemo;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return <button className={styles.button}>{children}</button>;
|
|
102
|
+
}
|
|
103
|
+
// Styles injected at runtime
|
|
104
|
+
// Automatic cleanup on unmount
|
|
105
|
+
// Fully dynamic based on props
|
|
124
106
|
|
|
125
107
|
|
|
126
108
|
```
|
|
@@ -313,9 +295,7 @@ compile({ hello });" > chaincss/main.jcss
|
|
|
313
295
|
}
|
|
314
296
|
```
|
|
315
297
|
|
|
316
|
-
|
|
317
|
-
See ChainCSS in action! Visit our interactive demo site - [https://melcanz08.github.io/chaincss_react_website/](https://melcanz08.github.io/chaincss_react_website/)
|
|
318
|
-
|
|
298
|
+
See ChainCSS in action! Visit our interactive demo site - [https://melcanz08.github.io/chaincss_react_website/]](https://melcanz08.github.io/chaincss_react_website/)
|
|
319
299
|
|
|
320
300
|
## Performance Comparison
|
|
321
301
|
|