Skip to content

Commit ea5a2af

Browse files
authored
Merge pull request #701 from bldng/ts-match-media
@theme-ui/match-media : Type variable
2 parents cf5b00a + 9a250ac commit ea5a2af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/match-media/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ export const useBreakpointIndex = (options: defaultOptions = {}) => {
5252
return value
5353
}
5454

55-
type Values = ((theme: Theme | null) => string[]) | string[]
55+
type Values<T> = ((theme: Theme | null) => T[]) | T[]
5656

57-
export const useResponsiveValue = (values: Values, options: defaultOptions = {}) => {
57+
export function useResponsiveValue<T>(
58+
values: Values<T>,
59+
options: defaultOptions = {}
60+
): T {
5861
const { theme } = useThemeUI()
5962
const array = typeof values === 'function' ? values(theme) : values
6063
const index = useBreakpointIndex(options)

0 commit comments

Comments
 (0)