-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IOAPPX-422-IOMarkdown
- Loading branch information
Showing
33 changed files
with
635 additions
and
159 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
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
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
52 changes: 16 additions & 36 deletions
52
ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerStandalone.tsx
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,52 +1,32 @@ | ||
import React, { ReactElement } from "react"; | ||
import { View } from "react-native"; | ||
import React from "react"; | ||
import { StyleSheet, View } from "react-native"; | ||
import { useIOSelector } from "../../../../../store/hooks"; | ||
import { isItwDiscoveryBannerRenderableSelector } from "../../store/selectors"; | ||
import { | ||
ItwDiscoveryBanner, | ||
ItwDiscoveryBannerProps | ||
} from "./ItwDiscoveryBanner"; | ||
|
||
type Props = Omit<ItwDiscoveryBannerProps, "handleOnClose"> & { | ||
fallbackComponent?: ReactElement; | ||
}; | ||
import { ItwDiscoveryBanner } from "./ItwDiscoveryBanner"; | ||
|
||
/** | ||
* to use in flows where either | ||
* - we need a fallback component | ||
* - we do not want to handle the banner's visibility logic externally | ||
* (see MultiBanner feature for the landing screen) | ||
* to use in flows where we do not want to handle the banner's visibility logic externally | ||
* (see MultiBanner feature for the landing screen) | ||
*/ | ||
export const ItwDiscoveryBannerStandalone = (props: Props) => { | ||
const [isVisible, setVisible] = React.useState(true); | ||
|
||
export const ItwDiscoveryBannerStandalone = () => { | ||
const isBannerRenderable = useIOSelector( | ||
isItwDiscoveryBannerRenderableSelector | ||
); | ||
|
||
const shouldBeHidden = React.useMemo( | ||
() => | ||
// Banner should be hidden if: | ||
!isVisible || // The user closed it by pressing the `x` button | ||
!isBannerRenderable, // the various validity checks fail | ||
[isBannerRenderable, isVisible] | ||
); | ||
|
||
if (shouldBeHidden) { | ||
const { fallbackComponent } = props; | ||
if (fallbackComponent) { | ||
return fallbackComponent; | ||
} | ||
if (!isBannerRenderable) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<View style={{ marginTop: 16, marginBottom: 8 }}> | ||
<ItwDiscoveryBanner | ||
ignoreMargins={true} | ||
handleOnClose={() => setVisible(false)} | ||
{...props} | ||
/> | ||
<View style={styles.wrapper}> | ||
<ItwDiscoveryBanner ignoreMargins={true} closable={false} /> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
wrapper: { | ||
marginTop: 16, | ||
marginBottom: 8 | ||
} | ||
}); |
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
Oops, something went wrong.