Skip to content

Commit 33a4bf9

Browse files
authored
Update README.md
Update Generic usage example
1 parent dd5c33a commit 33a4bf9

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,25 @@ import {
120120
stringifyStyleRule,
121121
} from "react-style-stringify";
122122

123-
type MyStyle = {
124-
padding: number;
123+
type MyStyles = {
124+
padding: string | number;
125125
fontSize: number;
126+
"--my-custom-prop": string;
126127
};
127128

128-
stringifyStyleDeclaration<MyStyle>({
129-
padding: 10,
130-
fontSize: 16,
129+
stringifyStyleDeclaration<Partial<MyStyles>>({
130+
padding: 20,
131+
"--my-custom-prop": "brown",
131132
})
132-
// Output: "padding:10px;font-size:16px;"
133+
// Output: "padding:20px;--my-custom-prop:brown;"
133134

134-
stringifyStyleRule<MyStyle>({
135+
stringifyStyleRule<Partial<MyStyles>>({
135136
".container": {
136-
padding: 10,
137-
fontSize: 16,
137+
padding: 20,
138+
"--my-custom-prop": "brown",
138139
},
139-
});
140-
// Output: ".container{"padding:10px;font-size:16px;"}"
140+
})
141+
// Output: ".container{padding:20px;--my-custom-prop:brown;}"
141142
```
142143

143144
> [!NOTE]

0 commit comments

Comments
 (0)