-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: remove setters from mobile hooks (#1262)
- Loading branch information
Showing
12 changed files
with
53 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
|
||
import type {Decorator} from '@storybook/react'; | ||
|
||
export const WithStrictMode: Decorator = (Story, context) => { | ||
const children = <Story {...context} />; | ||
|
||
if (context.parameters?.disableStrictMode) { | ||
return children; | ||
} | ||
|
||
return <React.StrictMode>{children}</React.StrictMode>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
|
||
import type {Decorator} from '@storybook/react'; | ||
|
||
import {ThemeProvider} from '../../src'; | ||
|
||
export const WithTheme: Decorator = (Story, context) => { | ||
return ( | ||
<ThemeProvider theme={context.globals.theme} direction={context.globals.direction}> | ||
<Story {...context} /> | ||
</ThemeProvider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import React from 'react'; | ||
|
||
import {MobileContext} from './MobileContext'; | ||
import type {MobileContextProps as Props} from './MobileContext'; | ||
import type {MobileContextProps} from './MobileContext'; | ||
|
||
export function useMobile(): [Props['mobile'], Props['setMobile']] { | ||
const {mobile, setMobile} = React.useContext(MobileContext); | ||
return [mobile, setMobile]; | ||
export function useMobile(): MobileContextProps['mobile'] { | ||
return React.useContext(MobileContext).mobile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import React from 'react'; | ||
|
||
import {MobileContext} from './MobileContext'; | ||
import type {MobileContextProps as Props} from './MobileContext'; | ||
import type {MobileContextProps} from './MobileContext'; | ||
|
||
export function usePlatform(): [Props['platform'], Props['setPlatform']] { | ||
const {platform, setPlatform} = React.useContext(MobileContext); | ||
return [platform, setPlatform]; | ||
export function usePlatform(): MobileContextProps['platform'] { | ||
return React.useContext(MobileContext).platform; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters