@quintype/native-components 2.30.1 → 2.30.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/Header/index.js +3 -2
- package/src/components/Header/styles.js +2 -2
- package/src/components/Story/index.js +3 -1
- package/src/components/StoryHeader/index.js +6 -5
- package/src/components/StoryHeader/styles.js +3 -0
- package/src/components/StoryTitle/index.js +2 -2
- package/src/components/StoryTitle/styles.js +2 -1
- package/src/components/Text/index.js +22 -4
package/package.json
CHANGED
|
@@ -12,8 +12,8 @@ import { headerStyles } from "./styles";
|
|
|
12
12
|
|
|
13
13
|
export const Header = (props) => {
|
|
14
14
|
const { theme } = useContext(AppTheme);
|
|
15
|
-
const { noBorder, centerAlignLogo } = props || {};
|
|
16
|
-
const styles = headerStyles(theme, noBorder, centerAlignLogo);
|
|
15
|
+
const { noBorder, centerAlignLogo, customHeight } = props || {};
|
|
16
|
+
const styles = headerStyles(theme, noBorder, centerAlignLogo, customHeight);
|
|
17
17
|
const headerStyle = StyleSheet.flatten([styles.header, props.style]);
|
|
18
18
|
const logoComponentStyle = StyleSheet.flatten([
|
|
19
19
|
styles.logoComponentStyle,
|
|
@@ -71,4 +71,5 @@ Header.propTypes = {
|
|
|
71
71
|
logoComponentStyle: PropTypes.object,
|
|
72
72
|
onPress: PropTypes.func,
|
|
73
73
|
noBorder: PropTypes.bool,
|
|
74
|
+
customHeight: PropTypes.number,
|
|
74
75
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export const headerStyles = (appThemeContext, noBorder, centerAlignLogo) => {
|
|
3
|
+
export const headerStyles = (appThemeContext, noBorder, centerAlignLogo, customHeight) => {
|
|
4
4
|
const { COLORS, DARK_MODE } = appThemeContext;
|
|
5
5
|
const headerContainerStyles = {
|
|
6
6
|
header: {
|
|
7
|
-
height: 48,
|
|
7
|
+
height: customHeight ?? 48,
|
|
8
8
|
backgroundColor: DARK_MODE ? COLORS.MONO6 : COLORS.BRAND_WHITE,
|
|
9
9
|
flexDirection: 'row',
|
|
10
10
|
alignItems: 'center',
|
|
@@ -152,7 +152,8 @@ export const Story = ({
|
|
|
152
152
|
gaTrigerredTTS,
|
|
153
153
|
commentData,
|
|
154
154
|
commentLoader,
|
|
155
|
-
storyLayout
|
|
155
|
+
storyLayout,
|
|
156
|
+
centerAlignStoryTitle
|
|
156
157
|
}) => {
|
|
157
158
|
const { theme } = useContext(AppTheme);
|
|
158
159
|
const { COLORS, FONT_SIZE, locale, DARK_MODE,translate, enableComments } = theme;
|
|
@@ -376,6 +377,7 @@ export const Story = ({
|
|
|
376
377
|
onAuthorPress={onAuthorPress}
|
|
377
378
|
onSectionPress={onSectionPress}
|
|
378
379
|
storyLayout={storyLayout}
|
|
380
|
+
centerAlignStoryTitle = {centerAlignStoryTitle}
|
|
379
381
|
/>
|
|
380
382
|
{ storyHasAccess === 'granted' && audioS3Key && (!showPlayer ?
|
|
381
383
|
(<TouchableOpacity onPress={async()=>{
|
|
@@ -65,7 +65,7 @@ const getHeroComponent = (props) => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export const StoryHeader = (props) => {
|
|
68
|
-
const { story, firstVideoElement, storyLayout } = props;
|
|
68
|
+
const { story, firstVideoElement, storyLayout, centerAlignStoryTitle } = props;
|
|
69
69
|
const sectionData = get(story, ['sections', 0], {});
|
|
70
70
|
const { theme } = useContext(AppTheme);
|
|
71
71
|
|
|
@@ -105,10 +105,11 @@ export const StoryHeader = (props) => {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
const getSectionName = (storyLayout = 'default') => {
|
|
108
|
-
const style = isHeadLinePriorityLayout ? styles.headlinePriority.sectionText : styles.sectionText
|
|
108
|
+
const style = isHeadLinePriorityLayout ? styles.headlinePriority.sectionText : styles.sectionText;
|
|
109
|
+
const centerAlignStyle = centerAlignStoryTitle? styles?.centerAlign: ''
|
|
109
110
|
return <TouchableOpacity onPress={navigateToSection}>
|
|
110
111
|
<Text
|
|
111
|
-
style={style}
|
|
112
|
+
style={[style, centerAlignStyle]}
|
|
112
113
|
testID={COMP_CONTENT_CONSTANTS.sectionName}
|
|
113
114
|
>
|
|
114
115
|
{sectionData['display-name'] || ''}
|
|
@@ -138,7 +139,7 @@ export const StoryHeader = (props) => {
|
|
|
138
139
|
return (
|
|
139
140
|
<View testID={props.testID}>
|
|
140
141
|
{getSectionName(storyLayout)}
|
|
141
|
-
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory} isHeadLinePriorityLayout={isHeadLinePriorityLayout}/>
|
|
142
|
+
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory} isHeadLinePriorityLayout={isHeadLinePriorityLayout} centerAlignStoryTitle={centerAlignStoryTitle}/>
|
|
142
143
|
{getHeroComponent(props)}
|
|
143
144
|
{showAttribution(storyLayout)}
|
|
144
145
|
<View style={styles.dateBlock}>
|
|
@@ -165,7 +166,7 @@ export const StoryHeader = (props) => {
|
|
|
165
166
|
{getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
|
|
166
167
|
</Text>
|
|
167
168
|
</View>
|
|
168
|
-
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory}/>
|
|
169
|
+
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory} centerAlignStoryTitle={centerAlignStoryTitle}/>
|
|
169
170
|
{getAuthorRow()}
|
|
170
171
|
{reviewTitle && <RatingLayout reviewTitle={reviewTitle} ratingValue={reviewData?.value} ratingLabel={reviewData?.label}/>}
|
|
171
172
|
</View>
|
|
@@ -7,9 +7,9 @@ import { AppTheme } from '../../utils';
|
|
|
7
7
|
import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
|
|
8
8
|
import PremiumIcons from '../../Icons/PremiumIcons/index';
|
|
9
9
|
|
|
10
|
-
export const StoryTitle = ({ title, subTitle, isPremiumStory, isHeadLinePriorityLayout }) => {
|
|
10
|
+
export const StoryTitle = ({ title, subTitle, isPremiumStory, isHeadLinePriorityLayout, centerAlignStoryTitle }) => {
|
|
11
11
|
const { theme } = useContext(AppTheme);
|
|
12
|
-
const styles = storyTitleStyles(theme);
|
|
12
|
+
const styles = storyTitleStyles({...theme, centerAlignStoryTitle});
|
|
13
13
|
const {
|
|
14
14
|
premiumIcon, COLORS, FONT_SIZE
|
|
15
15
|
} = theme;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export const storyTitleStyles = ({
|
|
4
|
-
COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier,
|
|
4
|
+
COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier,centerAlignStoryTitle
|
|
5
5
|
}) => StyleSheet.create({
|
|
6
6
|
container: {
|
|
7
7
|
padding: 10,
|
|
@@ -12,6 +12,7 @@ export const storyTitleStyles = ({
|
|
|
12
12
|
fontFamily: FONT_FAMILY.primaryBold,
|
|
13
13
|
lineHeight: FONT_SIZE.title * lineHeightMultiplier,
|
|
14
14
|
color: COLORS.BRAND_BLACK,
|
|
15
|
+
textAlign: centerAlignStoryTitle ? 'center' : 'auto',
|
|
15
16
|
},
|
|
16
17
|
subTitleStyle: {
|
|
17
18
|
fontSize: FONT_SIZE.h3,
|
|
@@ -8,16 +8,34 @@ import { AppTheme } from '../../utils/context';
|
|
|
8
8
|
|
|
9
9
|
export const Text = (props) => {
|
|
10
10
|
const { theme } = useContext(AppTheme);
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
FONT_FAMILY, COLORS, CAN_COPY_TEXT, lineHeightMultiplier,
|
|
13
|
+
} = theme;
|
|
14
|
+
|
|
15
|
+
// Flatten the style first
|
|
16
|
+
const flattenedStyle = StyleSheet.flatten([props.style]) || {};
|
|
17
|
+
|
|
18
|
+
// Use fontSize from style or fallback, and lineHeight from style or calculate
|
|
19
|
+
const { fontSize } = flattenedStyle;
|
|
20
|
+
let lineHeight;
|
|
21
|
+
if (flattenedStyle.lineHeight != null) {
|
|
22
|
+
lineHeight = flattenedStyle.lineHeight;
|
|
23
|
+
} else if (fontSize != null) {
|
|
24
|
+
lineHeight = fontSize * (lineHeightMultiplier ?? 1.5);
|
|
25
|
+
}
|
|
12
26
|
|
|
13
27
|
const RNStyle = {
|
|
14
28
|
fontFamily: props.primary ? FONT_FAMILY.primary : FONT_FAMILY.secondary,
|
|
15
29
|
writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
|
|
30
|
+
...(fontSize != null ? { fontSize } : {}),
|
|
31
|
+
...(lineHeight != null ? { lineHeight } : {}),
|
|
16
32
|
};
|
|
17
|
-
const flattenedStyle = StyleSheet.flatten([RNStyle, props.style]);
|
|
18
33
|
|
|
19
|
-
const
|
|
34
|
+
const mergedStyle = StyleSheet.flatten([RNStyle, props.style]);
|
|
20
35
|
|
|
36
|
+
const {
|
|
37
|
+
ellipsizeMode, numberOfLines, allowFontScaling, testID,
|
|
38
|
+
} = props;
|
|
21
39
|
const textData = I18nManager.isRTL ? `\u200F${props.children}` : props.children;
|
|
22
40
|
|
|
23
41
|
return (
|
|
@@ -29,7 +47,7 @@ export const Text = (props) => {
|
|
|
29
47
|
ellipsizeMode={ellipsizeMode}
|
|
30
48
|
numberOfLines={numberOfLines}
|
|
31
49
|
testID={testID}
|
|
32
|
-
style={
|
|
50
|
+
style={mergedStyle}
|
|
33
51
|
fontFamily={RNStyle.fontFamily}
|
|
34
52
|
allowFontScaling={allowFontScaling}
|
|
35
53
|
>
|