-
Notifications
You must be signed in to change notification settings - Fork 42
[SDK-366] parse-styles-for-components #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fb1e938
c474b93
e0c0a24
05114b1
d097190
7de5d61
015f8fa
2385cc0
b6d5354
fd91c2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import type { TextStyle, ViewStyle } from "react-native"; | ||
| import { colors } from "./colors"; | ||
|
|
||
| export const modalTitle: TextStyle = { | ||
| fontSize: 18, | ||
| fontWeight: '600', | ||
| marginBottom: 12, | ||
| textAlign: 'center', | ||
| }; | ||
|
|
||
| export const modalOverlay: ViewStyle = { | ||
| backgroundColor: 'rgba(0,0,0,0.5)', | ||
| flex: 1, | ||
| justifyContent: 'center', | ||
| padding: 20, | ||
| }; | ||
|
|
||
| export const modalContent: ViewStyle = { | ||
| backgroundColor: colors.backgroundPrimary, | ||
| borderRadius: 12, | ||
| maxHeight: '80%', | ||
| padding: 16, | ||
| }; | ||
|
|
||
| export const modalButtons: ViewStyle = { | ||
| flexDirection: 'row', | ||
| gap: 12, | ||
| justifyContent: 'flex-end', | ||
| }; | ||
|
|
||
| export const modalButton: ViewStyle = { | ||
| flex: 1, | ||
| }; | ||
|
|
||
| export const modalButtonText: TextStyle = { | ||
| color: colors.brandCyan, | ||
| fontSize: 14, | ||
| fontWeight: '600', | ||
| }; | ||
|
|
||
| export const modalButtonTextSelected: TextStyle = { | ||
| color: colors.backgroundPrimary, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| import { useMemo } from 'react'; | ||
| import { View, Text } from 'react-native'; | ||
|
|
||
| import { IterableEmbeddedViewType } from '../enums/IterableEmbeddedViewType'; | ||
|
|
||
| import { IterableEmbeddedBanner } from './IterableEmbeddedBanner'; | ||
| import { IterableEmbeddedCard } from './IterableEmbeddedCard'; | ||
| import { IterableEmbeddedNotification } from './IterableEmbeddedNotification'; | ||
| import type { IterableEmbeddedComponentProps } from '../types/IterableEmbeddedComponentProps'; | ||
| import { useEmbeddedView } from '../hooks/useEmbeddedView/useEmbeddedView'; | ||
|
|
||
| /** | ||
| * The props for the IterableEmbeddedView component. | ||
|
|
@@ -43,5 +45,41 @@ export const IterableEmbeddedView = ({ | |
| } | ||
| }, [viewType]); | ||
|
|
||
| return Cmp ? <Cmp {...props} /> : null; | ||
| const { parsedStyles } = useEmbeddedView(viewType, props); | ||
|
|
||
| return Cmp ? ( | ||
| <View> | ||
| <Text> | ||
| parsedStyles.backgroundColor: {String(parsedStyles.backgroundColor)} | ||
| </Text> | ||
| <Text>parsedStyles.borderColor: {String(parsedStyles.borderColor)}</Text> | ||
| <Text>parsedStyles.borderWidth: {parsedStyles.borderWidth}</Text> | ||
| <Text> | ||
| parsedStyles.borderCornerRadius: {parsedStyles.borderCornerRadius} | ||
| </Text> | ||
| <Text> | ||
| parsedStyles.primaryBtnBackgroundColor:{' '} | ||
| {String(parsedStyles.primaryBtnBackgroundColor)} | ||
| </Text> | ||
| <Text> | ||
| parsedStyles.primaryBtnTextColor:{' '} | ||
| {String(parsedStyles.primaryBtnTextColor)} | ||
| </Text> | ||
| <Text> | ||
| parsedStyles.secondaryBtnBackgroundColor:{' '} | ||
| {String(parsedStyles.secondaryBtnBackgroundColor)} | ||
| </Text> | ||
| <Text> | ||
| parsedStyles.secondaryBtnTextColor:{' '} | ||
| {String(parsedStyles.secondaryBtnTextColor)} | ||
| </Text> | ||
| <Text> | ||
| parsedStyles.titleTextColor: {String(parsedStyles.titleTextColor)} | ||
| </Text> | ||
| <Text> | ||
| parsedStyles.bodyTextColor: {String(parsedStyles.bodyTextColor)} | ||
| </Text> | ||
| <Cmp {...props} /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole function is going to go inside the other components in future PRs. This is just for making it easy to test. |
||
| </View> | ||
| ) : null; | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| export const embeddedBackgroundColors = { | ||
| notification: '#ffffff', | ||
| card: '#ffffff', | ||
| banner: '#ffffff', | ||
| }; | ||
|
|
||
| export const embeddedBorderColors = { | ||
| notification: '#E0DEDF', | ||
| card: '#E0DEDF', | ||
| banner: '#E0DEDF', | ||
| }; | ||
|
|
||
| export const embeddedPrimaryBtnBackgroundColors = { | ||
| notification: '#6A266D', | ||
| card: 'transparent', | ||
| banner: '#6A266D', | ||
| }; | ||
|
|
||
| export const embeddedPrimaryBtnTextColors = { | ||
| notification: '#ffffff', | ||
| card: '#79347F', | ||
| banner: '#ffffff', | ||
| }; | ||
|
|
||
| export const embeddedSecondaryBtnBackgroundColors = { | ||
| notification: 'transparent', | ||
| card: 'transparent', | ||
| banner: 'transparent', | ||
| }; | ||
|
|
||
| export const embeddedSecondaryBtnTextColors = { | ||
| notification: '#79347F', | ||
| card: '#79347F', | ||
| banner: '#79347F', | ||
| }; | ||
|
|
||
| export const embeddedTitleTextColors = { | ||
| notification: '#3D3A3B', | ||
| card: '#3D3A3B', | ||
| banner: '#3D3A3B', | ||
| }; | ||
|
|
||
| export const embeddedBodyTextColors = { | ||
| notification: '#787174', | ||
| card: '#787174', | ||
| banner: '#787174', | ||
| }; | ||
|
|
||
| export const embeddedBorderRadius = { | ||
| notification: 8, | ||
| card: 6, | ||
| banner: 8, | ||
| }; | ||
|
|
||
| export const embeddedBorderWidth = { | ||
| notification: 1, | ||
| card: 1, | ||
| banner: 1, | ||
| }; | ||
|
|
||
| export const embeddedStyles = { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're 100% correct. Good eye. They ended up in here because I was breaking down a very large PR. I'll remove them and add them back in later when they are needed. |
||
| backgroundColor: embeddedBackgroundColors, | ||
| bodyText: embeddedBodyTextColors, | ||
| borderColor: embeddedBorderColors, | ||
| borderCornerRadius: embeddedBorderRadius, | ||
| borderWidth: embeddedBorderWidth, | ||
| primaryBtnBackgroundColor: embeddedPrimaryBtnBackgroundColors, | ||
| primaryBtnTextColor: embeddedPrimaryBtnTextColors, | ||
| secondaryBtnBackground: embeddedSecondaryBtnBackgroundColors, | ||
| secondaryBtnTextColor: embeddedSecondaryBtnTextColors, | ||
| titleText: embeddedTitleTextColors, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './useEmbeddedView'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocker: This entire debug block (lines 51-81) renders raw style values as
<Text>nodes on screen, and wraps<Cmp>in an extra<View>. This looks like scaffolding/dev output and should be removed before merge.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just for demonstration and easy testing purposes. It will be removed in future PRs.