Skip to content

Commit 671022a

Browse files
committed
improvement: media queries level 5 compliance
1 parent a6af6a2 commit 671022a

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

packages/web-api-hooks/CHANGELOG.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55

66
## [3.0.1](https://github.com/kripod/react-hooks/compare/web-api-hooks@3.0.0...web-api-hooks@3.0.1) (2020-03-30)
77

8-
98
### Bug Fixes
109

11-
* bundle NetworkInformation properly ([2839251](https://github.com/kripod/react-hooks/commit/2839251e37ae6165bb3def0fea2d8f702cb86b86))
12-
13-
14-
15-
10+
- bundle NetworkInformation properly ([2839251](https://github.com/kripod/react-hooks/commit/2839251e37ae6165bb3def0fea2d8f702cb86b86))
1611

1712
# [3.0.0](https://github.com/kripod/react-hooks/compare/web-api-hooks@2.2.2...web-api-hooks@3.0.0) (2020-03-30)
1813

packages/web-api-hooks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function Component() {
7777
}
7878
```
7979

80-
Returns **(`"no-preference"` \| `"light"` \| `"dark"`)** Preferred color scheme.
80+
Returns **(`"light"` \| `"dark"`)** Preferred color scheme.
8181

8282
#### useDeviceMotion
8383

packages/web-api-hooks/src/ssr.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Hook<T>({ callback }: HookProps<T>): JSX.Element {
1313
return <>{JSON.stringify(callback())}</>;
1414
}
1515

16-
function renderHookToString<T>(callback: () => T): string {
16+
function renderHookToString(callback: () => unknown): string {
1717
return renderToString(<Hook callback={callback} />);
1818
}
1919

packages/web-api-hooks/src/useColorSchemePreference.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,9 @@ import useMedia from './useMedia';
1111
* // ...
1212
* }
1313
*/
14-
export default function useColorSchemePreference():
15-
| 'no-preference'
16-
| 'light'
17-
| 'dark' {
18-
const isLight = useMedia('(prefers-color-scheme: light)');
14+
export default function useColorSchemePreference(): 'light' | 'dark' {
1915
const isDark = useMedia('(prefers-color-scheme: dark)');
2016

21-
if (isLight) return 'light';
2217
if (isDark) return 'dark';
23-
return 'no-preference';
18+
return 'light';
2419
}

0 commit comments

Comments
 (0)