Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit d15e171

Browse files
committed
docs(readme): updated
1 parent 825ccdd commit d15e171

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

readme.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,35 @@ In development mode with we can see hot reloading preview by adding 'use client'
1818

1919
The className property and style are converted to an underscore with a hash as className.
2020

21-
## Scoped.style
21+
## Style.create and Style.set
2222

2323
```ts
24-
import { Scoped } from 'typedcssx';
24+
import { Style } from 'typedcssx';
2525

26-
export const style = Scoped.style({
27-
'& a': {
28-
fontSize: 16,
29-
color: 'black',
30-
},
31-
});
32-
```
33-
34-
## Scoped.sheet
35-
36-
```ts
37-
export const styles = Scoped.sheet({
26+
export const styles = Style.create({
3827
header_nav: {
3928
position: 'absolute',
4029
top: 0,
4130
},
4231
});
32+
33+
export const navStyle = Style.set({
34+
'& a': {
35+
fontSize: 16,
36+
color: '#333',
37+
},
38+
});
4339
```
4440

4541
## Example of use
4642

4743
```tsx
48-
import { styles, style } from './style.css';
44+
import { styles, navStyle } from './style.css';
4945

5046
const Header = () => {
5147
return (
5248
<header className={styles.header_nav}>
53-
<nav className={style}>
49+
<nav className={navStyle}>
5450
<a>content</a>
5551
<a>home</a>
5652
</nav>
@@ -59,22 +55,25 @@ const Header = () => {
5955
};
6056
```
6157

62-
## Global API
58+
## Global function
6359

64-
Scoped.gloabl and Scoped.root is do not use it in a variable scope.
60+
Style.gloabl and Style.root is do not use it in a variable scope.
6561
Wherever they are, the compiler reads them and writes them to the StyleSheet.
6662

6763
development there preview it, you need to load it in the 'use client' place and render it.
6864

6965
```ts
70-
Scoped.global({
66+
Style.global({
7167
h1: {
7268
color: 'var(--color-font)',
7369
background: 'var(--color-background)',
7470
},
71+
'h2:hover': {
72+
color: 'skyblue',
73+
},
7574
});
7675

77-
Scoped.root({
76+
Style.root({
7877
'--color-font': '#333',
7978
'--color-background': '#fff',
8079
});
@@ -83,11 +82,11 @@ Scoped.root({
8382
## MediaQuery
8483

8584
```ts
86-
import { Scoped, media } from 'typedcssx';
85+
import { Style, media } from 'typedcssx';
8786
const small = media('300px <= width <= 600px');
8887
const large = media('200px <= width <= 1400px');
8988

90-
export const styles = Scoped.sheet({
89+
export const styles = Style.create({
9190
header_nav: {
9291
fontSize: 18,
9392
color: 'white',

0 commit comments

Comments
 (0)