File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -511,7 +511,7 @@ export type ColorMode = {
511
511
}
512
512
513
513
export interface Theme {
514
- breakpoints ?: ObjectOrArray < number | string | symbol >
514
+ breakpoints ?: Array < string >
515
515
mediaQueries ?: { [ size : string ] : string }
516
516
space ?: ObjectOrArray < CSS . MarginProperty < number | string > >
517
517
fontSizes ?: ObjectOrArray < CSS . FontSizeProperty < number > >
Original file line number Diff line number Diff line change 18
18
},
19
19
"devDependencies" : {
20
20
"react" : " ^16.9.0" ,
21
- "theme-ui" : " ^0.3.1"
21
+ "@theme-ui/core" : " ^0.3.1" ,
22
+ "@theme-ui/css" : " ^0.3.1"
22
23
},
23
24
"peerDependencies" : {
24
25
"react" : " ^16.9.0" ,
Original file line number Diff line number Diff line change 1
1
import { useState , useEffect , useCallback } from 'react'
2
- import { useThemeUI } from 'theme-ui'
2
+ import { useThemeUI } from '@theme-ui/core'
3
+ import { Theme } from '@theme-ui/css'
3
4
4
5
// Shared with @theme -ui/css
5
6
const defaultBreakpoints = [ 40 , 52 , 64 ] . map ( n => n + 'em' )
6
7
7
- export const useBreakpointIndex = ( { defaultIndex = 0 } ) => {
8
+ type defaultOptions = {
9
+ defaultIndex ?: number
10
+ }
11
+
12
+ export const useBreakpointIndex = ( options : defaultOptions = { } ) => {
8
13
const context = useThemeUI ( )
14
+ const { defaultIndex = 0 } = options
9
15
const breakpoints =
10
16
( context . theme && context . theme . breakpoints ) || defaultBreakpoints
11
17
@@ -46,7 +52,9 @@ export const useBreakpointIndex = ({ defaultIndex = 0 }) => {
46
52
return value
47
53
}
48
54
49
- export const useResponsiveValue = ( values , options ) => {
55
+ type Values = ( ( theme : Theme | null ) => string [ ] ) | string [ ]
56
+
57
+ export const useResponsiveValue = ( values : Values , options : defaultOptions ) => {
50
58
const { theme } = useThemeUI ( )
51
59
const array = typeof values === 'function' ? values ( theme ) : values
52
60
const index = useBreakpointIndex ( options )
You can’t perform that action at this time.
0 commit comments