File tree 4 files changed +50
-1
lines changed
4 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ export * from './deprecated/motion'
7
7
export * from './deprecated/shape'
8
8
export * from './deprecated/typography'
9
9
10
- export * from './tokens/index'
10
+ export * from './media-queries/index'
11
+ export * from './tokens/index'
12
+
Original file line number Diff line number Diff line change
1
+ export * from './provide-window-media-query' ;
2
+ export * from './window-media-query' ;
3
+
Original file line number Diff line number Diff line change
1
+ import { WindowMediaQueryProvider } from "./window-media-query" ;
2
+
3
+ export const provideWindowMediaQuery = ( ) => new WindowMediaQueryProvider ( )
Original file line number Diff line number Diff line change
1
+ import plugin from "tailwindcss/plugin" ;
2
+ import type { IProvider } from "../declaration/provider.interface" ;
3
+ import { Strings } from "../utils/strings" ;
4
+
5
+ interface IWindowMediaQuery {
6
+ compact : string
7
+ medium : string
8
+ expanded : string
9
+ large : string
10
+ extraLarge : string
11
+ }
12
+
13
+ class DefaultWindowMediaQueryTokens implements IWindowMediaQuery {
14
+ compact = '@media (max-width: 600px)'
15
+ medium = '@media (min-width: 600px) and (max-width: 840px)'
16
+ expanded = '@media (min-width: 840px) and (max-width: 1200px)'
17
+ large = '@media (min-width: 1200px) and (max-width: 1600px)'
18
+ extraLarge = '@media (min-width: 1600px)'
19
+
20
+ public get defaultTokenRecord ( ) {
21
+ return {
22
+ compact : this . compact ,
23
+ medium : this . medium ,
24
+ expanded : this . expanded ,
25
+ large : this . large ,
26
+ extraLarge : this . extraLarge ,
27
+ }
28
+ }
29
+ }
30
+
31
+ export class WindowMediaQueryProvider extends DefaultWindowMediaQueryTokens implements IProvider {
32
+
33
+ getPlugin ( ) {
34
+ return plugin ( ( { addVariant } ) => {
35
+ for ( const mq of Object . entries ( this . defaultTokenRecord ) ) {
36
+ addVariant ( Strings . toKebabCase ( mq [ 0 ] ) , mq [ 1 ] )
37
+ }
38
+ } )
39
+ }
40
+
41
+ }
You can’t perform that action at this time.
0 commit comments