Skip to content

Commit 9a250ac

Browse files
committed
feat: add type variable to hook
1 parent cf5b00a commit 9a250ac

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)