-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: unify UI for DIDComm and OpenID flows for Offer and details scr…
…eens (#1365) Signed-off-by: Mostafa Gamal <[email protected]>
- Loading branch information
Showing
16 changed files
with
588 additions
and
285 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
58 changes: 58 additions & 0 deletions
58
packages/legacy/core/App/components/views/CredentialCardLogo.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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Image, StyleSheet, Text, View } from 'react-native' | ||
import { BrandingOverlay } from '@hyperledger/aries-oca' | ||
import { CredentialOverlay } from '@hyperledger/aries-oca/build/legacy' | ||
import { useTheme } from '../../contexts/theme' | ||
import { toImageSource } from '../../utils/credential' | ||
|
||
type Props = { | ||
overlay: CredentialOverlay<BrandingOverlay> | ||
} | ||
|
||
const logoHeight = 80 | ||
const paddingHorizontal = 24 | ||
|
||
const CredentialCardLogo: React.FC<Props> = ({ overlay }: Props) => { | ||
const { TextTheme } = useTheme() | ||
|
||
const styles = StyleSheet.create({ | ||
logoContainer: { | ||
top: -0.5 * logoHeight, | ||
left: paddingHorizontal, | ||
marginBottom: -1 * logoHeight, | ||
width: logoHeight, | ||
height: logoHeight, | ||
backgroundColor: '#ffffff', | ||
borderRadius: 8, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
shadowColor: '#000', | ||
shadowOffset: { | ||
width: 1, | ||
height: 1, | ||
}, | ||
shadowOpacity: 0.3, | ||
}, | ||
}) | ||
|
||
return ( | ||
<View style={styles.logoContainer}> | ||
{overlay.brandingOverlay?.logo ? ( | ||
<Image | ||
source={toImageSource(overlay.brandingOverlay?.logo)} | ||
style={{ | ||
resizeMode: 'cover', | ||
width: logoHeight, | ||
height: logoHeight, | ||
borderRadius: 8, | ||
}} | ||
/> | ||
) : ( | ||
<Text style={[TextTheme.title, { fontSize: 0.5 * logoHeight, color: '#000' }]}> | ||
{(overlay.metaOverlay?.name ?? overlay.metaOverlay?.issuer ?? 'C')?.charAt(0).toUpperCase()} | ||
</Text> | ||
)} | ||
</View> | ||
) | ||
} | ||
|
||
export default CredentialCardLogo |
72 changes: 72 additions & 0 deletions
72
packages/legacy/core/App/components/views/CredentialDetailPrimaryHeader.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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { StyleSheet, Text, useWindowDimensions, View } from 'react-native' | ||
import { BrandingOverlay } from '@hyperledger/aries-oca' | ||
import { CredentialOverlay } from '@hyperledger/aries-oca/build/legacy' | ||
import CardWatermark from '../../components/misc/CardWatermark' | ||
import { useTheme } from '../../contexts/theme' | ||
import { credentialTextColor } from '../../utils/credential' | ||
import { testIdWithKey } from '../../utils/testable' | ||
|
||
type CredentialDetailPrimaryHeaderProps = { | ||
overlay: CredentialOverlay<BrandingOverlay> | ||
} | ||
|
||
const paddingHorizontal = 24 | ||
const paddingVertical = 16 | ||
const logoHeight = 80 | ||
|
||
const CredentialDetailPrimaryHeader: React.FC<CredentialDetailPrimaryHeaderProps> = ({ overlay }: CredentialDetailPrimaryHeaderProps) => { | ||
const { TextTheme, ColorPallet } = useTheme() | ||
const { width, height } = useWindowDimensions() | ||
const styles = StyleSheet.create({ | ||
primaryHeaderContainer: { | ||
paddingHorizontal, | ||
paddingVertical, | ||
}, | ||
textContainer: { | ||
color: credentialTextColor(ColorPallet, overlay.brandingOverlay?.primaryBackgroundColor), | ||
}, | ||
}) | ||
|
||
return ( | ||
<View | ||
testID={testIdWithKey('CredentialDetailsPrimaryHeader')} | ||
style={[styles.primaryHeaderContainer, { zIndex: -1 }]} | ||
> | ||
<View> | ||
{overlay.metaOverlay?.watermark && ( | ||
<CardWatermark width={width} height={height} watermark={overlay.metaOverlay?.watermark} /> | ||
)} | ||
<Text | ||
testID={testIdWithKey('CredentialIssuer')} | ||
style={[ | ||
TextTheme.label, | ||
styles.textContainer, | ||
{ | ||
paddingLeft: logoHeight + paddingVertical, | ||
paddingBottom: paddingVertical, | ||
lineHeight: 19, | ||
opacity: 0.8, | ||
}, | ||
]} | ||
numberOfLines={1} | ||
> | ||
{overlay.metaOverlay?.issuer} | ||
</Text> | ||
<Text | ||
testID={testIdWithKey('CredentialName')} | ||
style={[ | ||
TextTheme.normal, | ||
styles.textContainer, | ||
{ | ||
lineHeight: 24, | ||
}, | ||
]} | ||
> | ||
{overlay.metaOverlay?.name} | ||
</Text> | ||
</View> | ||
</View> | ||
) | ||
} | ||
|
||
export default CredentialDetailPrimaryHeader |
43 changes: 43 additions & 0 deletions
43
packages/legacy/core/App/components/views/CredentialDetailSecondaryHeader.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import { BrandingOverlay } from '@hyperledger/aries-oca' | ||
import { CredentialOverlay } from '@hyperledger/aries-oca/build/legacy' | ||
import { ImageBackground, StyleSheet, View } from 'react-native' | ||
import { toImageSource } from '../../utils/credential' | ||
import { testIdWithKey } from '../../utils/testable' | ||
|
||
type CredentialDetailSecondaryHeaderProps = { | ||
overlay: CredentialOverlay<BrandingOverlay> | ||
} | ||
|
||
const logoHeight = 80 | ||
|
||
const CredentialDetailSecondaryHeader: React.FC<CredentialDetailSecondaryHeaderProps> = ({ overlay }: CredentialDetailSecondaryHeaderProps) => { | ||
const styles = StyleSheet.create({ | ||
secondaryHeaderContainer: { | ||
height: 1.5 * logoHeight, | ||
backgroundColor: | ||
(overlay.brandingOverlay?.backgroundImage | ||
? 'rgba(0, 0, 0, 0)' | ||
: overlay.brandingOverlay?.secondaryBackgroundColor) ?? 'rgba(0, 0, 0, 0.24)', | ||
}, | ||
}) | ||
|
||
return ( | ||
<> | ||
{overlay.brandingOverlay?.backgroundImage ? ( | ||
<ImageBackground | ||
source={toImageSource(overlay.brandingOverlay?.backgroundImage)} | ||
imageStyle={{ | ||
resizeMode: 'cover', | ||
}} | ||
> | ||
<View testID={testIdWithKey('CredentialDetailsSecondaryHeader')} style={styles.secondaryHeaderContainer} /> | ||
</ImageBackground> | ||
) : ( | ||
<View testID={testIdWithKey('CredentialDetailsSecondaryHeader')} style={styles.secondaryHeaderContainer} /> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
export default CredentialDetailSecondaryHeader |
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.