@quintype/native-components 2.28.0 → 2.28.1

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.
Files changed (46) hide show
  1. package/bin-dev-scripts/standard-version-release.sh +11 -11
  2. package/package.json +1 -1
  3. package/src/components/AlsoRead/index.js +4 -4
  4. package/src/components/AuthorRow/index.js +3 -3
  5. package/src/components/BackNavigator/index.js +6 -6
  6. package/src/components/Button/index.js +1 -1
  7. package/src/components/CollectionCard/index.js +20 -10
  8. package/src/components/CollectionTitle/index.js +20 -38
  9. package/src/components/CollectionTitle/styles.js +11 -13
  10. package/src/components/CustomSwitch/index.js +4 -4
  11. package/src/components/DailyMotionPlayer/index.js +2 -2
  12. package/src/components/Header/index.js +2 -2
  13. package/src/components/Html/index.js +4 -4
  14. package/src/components/IconText/index.js +4 -4
  15. package/src/components/JSEmbedElement/index.js +3 -3
  16. package/src/components/LightBoxImage/index.js +2 -2
  17. package/src/components/PDFReader/index.js +7 -8
  18. package/src/components/PrimaryStoryCard/index.js +47 -92
  19. package/src/components/PrimaryStoryCard/styles.js +30 -49
  20. package/src/components/RadioButton/index.js +3 -3
  21. package/src/components/Rating/index.js +1 -1
  22. package/src/components/RelatedStoriesCard/index.js +2 -12
  23. package/src/components/SecondaryStoryCard/index.js +59 -108
  24. package/src/components/SecondaryStoryCard/styles.js +35 -55
  25. package/src/components/Story/index.js +12 -13
  26. package/src/components/StoryHeader/index.js +8 -8
  27. package/src/components/StoryTemplateIcon/index.js +1 -1
  28. package/src/components/StoryTemplateIcon/styles.js +1 -1
  29. package/src/components/StoryText/index.js +5 -2
  30. package/src/components/TextA/index.js +4 -4
  31. package/src/components/TextBigFact/index.js +4 -4
  32. package/src/components/TextBlockQuote/index.js +5 -5
  33. package/src/components/TextBlurb/index.js +3 -3
  34. package/src/components/TextQandA/index.js +2 -3
  35. package/src/components/index.js +1 -5
  36. package/src/components/CollectionCardNew/index.js +0 -84
  37. package/src/components/CollectionTitle/CollectionTitle.test.js +0 -12
  38. package/src/components/CollectionTitle/__snapshots__/CollectionTitle.test.js.snap +0 -3
  39. package/src/components/CollectionTitleNew/index.js +0 -44
  40. package/src/components/CollectionTitleNew/styles.js +0 -20
  41. package/src/components/PrimaryStoryCard/PrimaryStoryCard.test.js +0 -43
  42. package/src/components/PrimaryStoryCardNew/index.js +0 -106
  43. package/src/components/PrimaryStoryCardNew/styles.js +0 -47
  44. package/src/components/SecondaryStoryCard/SecondaryStoryCard.test.js +0 -51
  45. package/src/components/SecondaryStoryCardNew/index.js +0 -113
  46. package/src/components/SecondaryStoryCardNew/styles.js +0 -59
@@ -1,10 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { View, Linking, StyleSheet } from 'react-native';
3
+ import { StyleSheet, View } from 'react-native';
4
4
  import HTML from 'react-native-render-html';
5
- import { textBlurbStyles } from './styles';
6
- import { AppTheme } from '../../utils/context';
7
5
  import { customHTMLStyles } from '../../constants/renderHTML';
6
+ import { AppTheme } from '../../utils/context';
7
+ import { textBlurbStyles } from './styles';
8
8
 
9
9
  export const TextBlurb = ({ text }) => {
10
10
  const { theme, useDeeplinkHandler } = useContext(AppTheme);
@@ -1,11 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import { View } from 'react-native';
4
- import { Text } from '../index';
5
- import { textQandAStyles } from './styles';
6
4
  import { AppTheme } from '../../utils/context';
7
- import { TextQ } from '../TextQ/index';
8
5
  import { TextA } from '../TextA/index';
6
+ import { TextQ } from '../TextQ/index';
7
+ import { textQandAStyles } from './styles';
9
8
 
10
9
  export const TextQandA = ({ question, answer }) => {
11
10
  const { theme } = useContext(AppTheme);
@@ -3,21 +3,17 @@ export { AuthorRow } from './AuthorRow';
3
3
  export { BackNavigator } from './BackNavigator';
4
4
  export { Button } from './Button';
5
5
  export { CollectionCard } from './CollectionCard';
6
- export { CollectionCardNew } from './CollectionCardNew';
7
6
  export { CollectionTitle } from './CollectionTitle';
8
- export { CollectionTitleNew } from './CollectionTitleNew';
9
7
  export { CustomLoader } from './CustomLoader';
10
8
  export { FBCommentsRow } from './FBCommentsRow';
11
9
  export { Header } from './Header';
12
10
  export { JSEmbedElement } from './JSEmbedElement';
13
11
  export { PDFReader } from './PDFReader';
14
12
  export { PrimaryStoryCard } from './PrimaryStoryCard';
15
- export { PrimaryStoryCardNew } from './PrimaryStoryCardNew';
16
13
  export { RadioButton } from './RadioButton';
17
14
  export { ResponsiveImage } from './ResponsiveImage';
18
15
  export { Search } from './Search';
19
16
  export { SecondaryStoryCard } from './SecondaryStoryCard';
20
- export { SecondaryStoryCardNew } from './SecondaryStoryCardNew';
21
17
  export { ShareButton } from './ShareButton';
22
18
  export { Story } from './Story';
23
19
  export { StoryContent } from './StoryContent';
@@ -44,7 +40,7 @@ export { IconText } from './IconText';
44
40
  export { CustomSwitch } from './CustomSwitch';
45
41
  export { RelatedStoriesCard } from './RelatedStoriesCard';
46
42
  export { References } from './References';
47
- export { StoryTemplateIcon } from './StoryTemplateIcon'
48
43
  export { StoryCardDetailsRow } from './StoryCardDetailsRow';
49
44
  export { TextA } from './TextA'
50
45
  export { TextQ } from './TextQ'
46
+ export { StoryTemplateIcon } from './StoryTemplateIcon'
@@ -1,84 +0,0 @@
1
- import get from 'lodash/get';
2
- import isEmpty from 'lodash/isEmpty';
3
- import PropTypes from 'prop-types';
4
- import React, { memo } from 'react';
5
- import { getScreenPercentageWidth } from '../../utils/index';
6
- import {
7
- CollectionTitleNew,
8
- PrimaryStoryCardNew,
9
- SecondaryStoryCardNew,
10
- ShareButton,
11
- } from '../index';
12
-
13
- const CollectionCardNewBase = ({
14
- cdn,
15
- collectionName,
16
- stories,
17
- onCollectionPress,
18
- onStoryPress,
19
- collectionTestID,
20
- offset,
21
- horizontalPadding,
22
- initialOffset, /* Number of items to load on first load */
23
- hideCollectionTitle,
24
- }) => {
25
- const sliceLimit = offset || initialOffset || 5;
26
- const primaryStory = !isEmpty(stories) && get(stories, [0, 'story'], stories[0]);
27
-
28
- return (
29
- <>
30
- {!hideCollectionTitle && (
31
- <CollectionTitleNew
32
- title={collectionName}
33
- onPress={onCollectionPress}
34
- horizontalPadding={horizontalPadding}
35
- />
36
- )}
37
- <PrimaryStoryCardNew
38
- collectionTestID={collectionTestID}
39
- onPress={() => {
40
- !isEmpty(stories) && onStoryPress(primaryStory);
41
- }}
42
- cdn={cdn}
43
- story={!isEmpty(stories) ? primaryStory : {}}
44
- iconComponent={<ShareButton story={primaryStory} inListingStoryCard />}
45
- imageWidth={getScreenPercentageWidth(100) - 2 * horizontalPadding}
46
- horizontalPadding={horizontalPadding}
47
- />
48
- {stories.slice(1, sliceLimit).map((currentStory) => {
49
- const secondaryStory = get(currentStory, ['story'], currentStory);
50
- return (
51
- <SecondaryStoryCardNew
52
- collectionTestID={collectionTestID}
53
- onPress={() => onStoryPress(secondaryStory)}
54
- key={secondaryStory?.id}
55
- cdn={cdn}
56
- story={secondaryStory}
57
- iconComponent={<ShareButton story={secondaryStory} inListingStoryCard />}
58
- imageWidth={getScreenPercentageWidth(28)}
59
- horizontalPadding={horizontalPadding}
60
- />
61
- );
62
- })}
63
- </>
64
- );
65
- };
66
-
67
- CollectionCardNewBase.propTypes = {
68
- offset: PropTypes.number,
69
- initialOffset: PropTypes.number,
70
- cdn: PropTypes.string.isRequired,
71
- collectionName: PropTypes.string,
72
- stories: PropTypes.array.isRequired,
73
- onCollectionPress: PropTypes.func,
74
- onStoryPress: PropTypes.func,
75
- collectionTestID: PropTypes.string,
76
- horizontalPadding: PropTypes.number,
77
- hideCollectionTitle: PropTypes.bool,
78
- };
79
-
80
- CollectionCardNewBase.defaultProps = {
81
- horizontalPadding: 12,
82
- };
83
-
84
- export const CollectionCardNew = memo(CollectionCardNewBase);
@@ -1,12 +0,0 @@
1
- import 'react-native';
2
- import React from 'react';
3
- import renderer from 'react-test-renderer';
4
-
5
- import { CollectionTitle } from './index';
6
- import { mockContext } from '../../utils';
7
-
8
- test('renders correctly', () => {
9
- const component = mockContext(<CollectionTitle />);
10
- const tree = renderer.create(component).toJSON();
11
- expect(tree).toMatchSnapshot();
12
- });
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`renders correctly 1`] = `null`;
@@ -1,44 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useContext, memo } from 'react';
3
- import {
4
- TextStyle,
5
- TouchableOpacity,
6
- TouchableOpacityProps,
7
- StyleSheet,
8
- } from 'react-native';
9
- import { Text } from '../index';
10
- import { collectionTitleStyles } from './styles';
11
- import { AppTheme } from '../../utils';
12
-
13
- const CollectionTitleNewBase = (props) => {
14
- const { theme } = useContext(AppTheme);
15
- const styles = collectionTitleStyles(theme);
16
- const containerStyle = StyleSheet.flatten([
17
- styles.container,
18
- { paddingHorizontal: props.horizontalPadding },
19
- ]);
20
- const titleStyle = StyleSheet.flatten([styles.title, props.titleStyle]);
21
-
22
- if (!props.title) {
23
- return null;
24
- }
25
-
26
- return (
27
- <TouchableOpacity style={containerStyle} onPress={props.onPress}>
28
- <Text style={titleStyle}>{props.title}</Text>
29
- </TouchableOpacity>
30
- );
31
- };
32
-
33
- CollectionTitleNewBase.propTypes = TouchableOpacityProps
34
- && {
35
- title: PropTypes.string,
36
- titleStyle: TextStyle,
37
- horizontalPadding: PropTypes.number,
38
- };
39
-
40
- CollectionTitleNewBase.defaultProps = {
41
- horizontalPadding: 12,
42
- };
43
-
44
- export const CollectionTitleNew = memo(CollectionTitleNewBase);
@@ -1,20 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- export const collectionTitleStyles = (appThemeContext) => {
4
- const { COLORS, FONT_SIZE, FONT_FAMILY } = appThemeContext;
5
-
6
- return StyleSheet.create({
7
- container: {
8
- justifyContent: 'center',
9
- backgroundColor: COLORS.BRAND_WHITE,
10
- paddingHorizontal: 12,
11
- paddingVertical: 8,
12
- marginTop: 8,
13
- },
14
- title: {
15
- fontSize: FONT_SIZE.h3,
16
- fontFamily: FONT_FAMILY.secondaryBold,
17
- color: COLORS.BRAND_5,
18
- },
19
- });
20
- };
@@ -1,43 +0,0 @@
1
- import { cleanup, render, fireEvent } from '@testing-library/react-native';
2
- import React from 'react';
3
- import 'react-native';
4
- import { mockContext } from '../../utils';
5
- import { PrimaryStoryCard } from './index';
6
- import { data } from '../../constants/test-data/story.json';
7
- import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
8
-
9
- const storyData = data.story;
10
- const onPress = jest.fn();
11
-
12
- describe('Test Primary Story Card :', () => {
13
- afterEach(cleanup);
14
- test('renders author name properly', () => {
15
- const { getByTestId } = render(
16
- mockContext(<PrimaryStoryCard story={storyData} />),
17
- );
18
- const element = getByTestId(COMP_GENERAL_CONSTANTS.primaryStoryAuthor);
19
- expect(element.props.children).toBe('By Raghavendra Vaidya | ');
20
- });
21
- test('renders story headline properly', () => {
22
- const { getByTestId } = render(
23
- mockContext(<PrimaryStoryCard story={storyData} />),
24
- );
25
- const element = getByTestId(COMP_GENERAL_CONSTANTS.primaryStoryHeadline);
26
- expect(element.props.children).toBe('Jack and jill');
27
- });
28
- test('renders story publish date properly', () => {
29
- const { getByTestId } = render(
30
- mockContext(<PrimaryStoryCard story={storyData} />),
31
- );
32
- const element = getByTestId(COMP_GENERAL_CONSTANTS.primaryStoryPubishedAt);
33
- expect(element.props.children).toBe('1 Feb, 2021');
34
- });
35
- test('OnPress handler called properly', () => {
36
- const { getByTestId } = render(
37
- mockContext(<PrimaryStoryCard story={storyData} onPress={onPress} />),
38
- );
39
- const element = getByTestId(COMP_GENERAL_CONSTANTS.primaryStoryCard);
40
- fireEvent(element, 'press');
41
- expect(onPress).toHaveBeenCalled();
42
- });
43
- });
@@ -1,106 +0,0 @@
1
- import { get, throttle } from 'lodash';
2
- import PropTypes from 'prop-types';
3
- import React, { useContext, memo } from 'react';
4
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
5
- import {
6
- AppTheme,
7
- getImageMetadata,
8
- getImageSlug,
9
- } from '../../utils';
10
- import { getStoryHeadline } from '../../utils/story';
11
- import { ResponsiveImage, Text, StoryCardDetailsRow, StoryTemplateIcon } from '../index';
12
- import { storyStyles } from './styles';
13
- import {
14
- COMP_GENERAL_CONSTANTS,
15
- COMP_CONTENT_CONSTANTS,
16
- } from '../../constants/component-constants';
17
- import PremiumIcons from '../../Icons/PremiumIcons/index';
18
-
19
- const PrimaryStoryCardNewBase = (props) => {
20
- const { story = {} } = props;
21
- const { theme } = useContext(AppTheme);
22
- const {
23
- COLORS,
24
- FONT_SIZE,
25
- premiumIcon,
26
- storyCardOptions = {},
27
- } = theme || {};
28
-
29
- const styles = storyStyles(theme);
30
- const containerStyle = StyleSheet.flatten([
31
- styles.container,
32
- { paddingHorizontal: props.horizontalPadding },
33
- ]);
34
- const headlineStyle = StyleSheet.flatten([
35
- styles.headline,
36
- props.headlineStyle,
37
- ]);
38
-
39
- const isPremiumStory = story['access'] === 'subscription';
40
-
41
- const throttledOnpress = throttle(props.onPress, 1000);
42
-
43
- return (
44
- <>
45
- <TouchableOpacity
46
- testID={COMP_GENERAL_CONSTANTS.primaryStoryCard}
47
- onPress={throttledOnpress}
48
- activeOpacity={0.8}
49
- style={containerStyle}
50
- >
51
- <ResponsiveImage
52
- metaData={getImageMetadata(story)}
53
- slug={getImageSlug(story)}
54
- cdn={props.cdn}
55
- imageWidth={props.imageWidth}
56
- >
57
- <View style={styles.storyTypeContainer}>
58
- <StoryTemplateIcon storyTemplate={story['story-template']} cardType="primary" theme={theme} />
59
- </View>
60
- </ResponsiveImage>
61
- <View style={styles.contentContainer}>
62
- <View style={styles.headlineAndTimestampContainer}>
63
- {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
64
- <View style={{display:'flex', flexDirection:'row'}}>
65
- <Text
66
- primary
67
- numberOfLines={storyCardOptions.numberOfLinesForTitle}
68
- ellipsizeMode="tail"
69
- style={headlineStyle}
70
- testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
71
- >
72
- {isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h2} /> }
73
- {isPremiumStory && premiumIcon !=='none' && ' '}
74
- {getStoryHeadline(story)}
75
- </Text>
76
- </View>
77
- <StoryCardDetailsRow
78
- authorName={get(story.authors, [0, 'name'])}
79
- publishedAt={story["published-at"]}
80
- readTime={story['read-time']}
81
- />
82
- </View>
83
- <View style={styles.icon}>{props.iconComponent}</View>
84
- </View>
85
- </TouchableOpacity>
86
- <View style={[styles.separatorLine, {marginHorizontal: props.horizontalPadding}]}/>
87
- </>
88
- );
89
- };
90
-
91
- PrimaryStoryCardNewBase.propTypes = {
92
- cdn: PropTypes.string,
93
- imageWidth: PropTypes.number,
94
- headlineStyle: PropTypes.func,
95
- story: PropTypes.object.isRequired,
96
- onPress: PropTypes.func,
97
- horizontalPadding: PropTypes.number,
98
- iconComponent: PropTypes.element,
99
- };
100
-
101
- PrimaryStoryCardNewBase.defaultProps = {
102
- cdn: '',
103
- horizontalPadding: 12,
104
- };
105
-
106
- export const PrimaryStoryCardNew = memo(PrimaryStoryCardNewBase);
@@ -1,47 +0,0 @@
1
- export const storyStyles = ({COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {}}) => ({
2
- container: {
3
- backgroundColor: COLORS.BRAND_WHITE,
4
- paddingVertical: 10,
5
- gap: 10,
6
- },
7
- contentContainer: {
8
- flexDirection: 'row',
9
- justifyContent: 'space-between',
10
- alignItems: 'flex-start',
11
- gap: 10,
12
- },
13
- headlineAndTimestampContainer: {
14
- flexShrink: 1,
15
- gap: 4,
16
- },
17
- icon: {
18
- marginBottom: 4,
19
- marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
20
- },
21
- sectionName: {
22
- color: COLORS.BRAND_1,
23
- fontSize: FONT_SIZE.h4,
24
- lineHeight: FONT_SIZE.h4 * lineHeightMultiplier,
25
- },
26
- headline: {
27
- fontFamily: FONT_FAMILY.primaryBold,
28
- fontSize: FONT_SIZE.title,
29
- lineHeight: FONT_SIZE.title * lineHeightMultiplier,
30
- color: COLORS.BRAND_BLACK,
31
- marginBottom: 4,
32
- },
33
- storyTypeContainer: {
34
- position: 'absolute',
35
- bottom: 0,
36
- left: 0,
37
- },
38
- premiumIcon: {
39
- marginTop: FONT_SIZE.h3 * 0.92,
40
- marginRight: 5,
41
- },
42
- separatorLine: {
43
- height: 0.8,
44
- opacity: 0.1,
45
- backgroundColor: COLORS.BRAND_BLACK,
46
- },
47
- });
@@ -1,51 +0,0 @@
1
- import { cleanup, render, fireEvent } from '@testing-library/react-native';
2
- import React from 'react';
3
- import 'react-native';
4
- import { mockContext } from '../../utils';
5
- import { SecondaryStoryCard } from './index';
6
- import { data } from '../../constants/test-data/story.json';
7
- import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
8
-
9
- const storyData = data.story;
10
- const onPress = jest.fn();
11
-
12
- describe('Test Secondary Story Card :', () => {
13
- afterEach(cleanup);
14
- test('renders author name properly', () => {
15
- const { getByTestId } = render(
16
- mockContext(<SecondaryStoryCard story={storyData} />),
17
- );
18
- const element = getByTestId(COMP_GENERAL_CONSTANTS.secondaryStoryAuthor);
19
- expect(element.props.children).toBe('By Raghavendra Vaidya | ');
20
- });
21
- test('renders story headline properly', () => {
22
- const { getByTestId } = render(
23
- mockContext(<SecondaryStoryCard story={storyData} />),
24
- );
25
- const element = getByTestId(COMP_GENERAL_CONSTANTS.secondaryStoryHeadline);
26
- expect(element.props.children).toBe('Jack and jill');
27
- });
28
- test('renders story date properly', () => {
29
- const { getByTestId } = render(
30
- mockContext(<SecondaryStoryCard story={storyData} />),
31
- );
32
- const element = getByTestId(
33
- COMP_GENERAL_CONSTANTS.secondaryStoryPubishedAt,
34
- );
35
- expect(element.props.children).toBe('1 Feb, 2021');
36
- });
37
- test('OnPress handler called properly', () => {
38
- const { getByTestId } = render(
39
- mockContext(
40
- <SecondaryStoryCard
41
- story={storyData}
42
- onPress={onPress}
43
- collectionTestID="secondaryStoryCardView"
44
- />,
45
- ),
46
- );
47
- const element = getByTestId(COMP_GENERAL_CONSTANTS.secondaryStoryCard);
48
- fireEvent(element, 'press');
49
- expect(onPress).toHaveBeenCalled();
50
- });
51
- });
@@ -1,113 +0,0 @@
1
- import { get, throttle } from 'lodash';
2
- import PropTypes from 'prop-types';
3
- import React, { useContext, memo } from 'react';
4
- import {
5
- StyleSheet,
6
- TouchableOpacity,
7
- View,
8
- TextStyle,
9
- TouchableOpacityProps,
10
- } from 'react-native';
11
- import {
12
- AppTheme,
13
- getImageMetadata,
14
- getImageSlug,
15
- } from '../../utils';
16
- import { getStoryHeadline } from '../../utils/story';
17
- import { ResponsiveImage, Text, StoryCardDetailsRow, StoryTemplateIcon } from '../index';
18
- import { storyStyles } from './styles';
19
- import {
20
- COMP_GENERAL_CONSTANTS,
21
- COMP_CONTENT_CONSTANTS,
22
- } from '../../constants/component-constants';
23
- import PremiumIcons from '../../Icons/PremiumIcons/index';
24
-
25
- const SecondaryStoryCardNewBase = (props) => {
26
- const { story = {} } = props;
27
- const { theme } = useContext(AppTheme);
28
- const {
29
- COLORS,
30
- premiumIcon,
31
- FONT_SIZE,
32
- storyCardOptions = {},
33
- } = theme;
34
-
35
- const styles = storyStyles(theme);
36
- const containerStyle = StyleSheet.flatten([
37
- styles.container,
38
- { paddingHorizontal: props.horizontalPadding },
39
- ]);
40
- const headlineStyle = StyleSheet.flatten([
41
- styles.headline,
42
- props.headlineStyle,
43
- ]);
44
-
45
- const isPremiumStory = story['access'] === 'subscription';
46
-
47
- const throttledOnpress = throttle(props.onPress, 1000);
48
-
49
- return (
50
- <>
51
- <TouchableOpacity
52
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
53
- onPress={throttledOnpress}
54
- activeOpacity={0.8}
55
- style={containerStyle}
56
- >
57
- <View style={[styles.imageAndDetails, storyCardOptions.alignSmallCardImage === "right" && { flexDirection: 'row-reverse' }]}>
58
- {storyCardOptions.enableSmallCardImage && (<ResponsiveImage
59
- styles={styles.image}
60
- metaData={getImageMetadata(story)}
61
- slug={getImageSlug(story) || ''}
62
- cdn={props.cdn || ''}
63
- imageWidth={props.imageWidth}
64
- >
65
- <View style={styles.storyTypeContainer}>
66
- <StoryTemplateIcon storyTemplate={story['story-template']} theme={theme} />
67
- </View>
68
- </ResponsiveImage>)
69
- }
70
- <View style={styles.headlineAndTimestampBlockContainer}>
71
- {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
72
- <View style={{ display: 'flex', flexDirection: 'row' }}>
73
- <Text
74
- primary
75
- numberOfLines={storyCardOptions.numberOfLinesForTitle}
76
- ellipsizeMode="tail"
77
- style={headlineStyle}
78
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
79
- >
80
- {isPremiumStory && premiumIcon !== 'none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h4} />}
81
- {isPremiumStory && premiumIcon !== 'none' && ' '}
82
- {getStoryHeadline(story)?.trim()}
83
- </Text>
84
- </View>
85
- <StoryCardDetailsRow
86
- authorName={get(story.authors, [0, 'name'])}
87
- publishedAt={story["published-at"]}
88
- readTime={story['read-time']}
89
- />
90
- </View>
91
- </View>
92
- <View style={styles.icon}>{props.iconComponent}</View>
93
- </TouchableOpacity>
94
- <View style={[styles.separatorLine, { marginHorizontal: props.horizontalPadding }]} />
95
- </>
96
- );
97
- };
98
-
99
- SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
100
- cdn: PropTypes.string.isRequired,
101
- imageWidth: PropTypes.number,
102
- headlineStyle: TextStyle,
103
- story: PropTypes.any.isRequired,
104
- iconComponent: PropTypes.element,
105
- horizontalPadding: PropTypes.number,
106
- };
107
-
108
- SecondaryStoryCardNewBase.defaultProps = {
109
- cdn: '',
110
- horizontalPadding: 12,
111
- };
112
-
113
- export const SecondaryStoryCardNew = memo(SecondaryStoryCardNewBase);
@@ -1,59 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- export const storyStyles = ({ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {} }) => StyleSheet.create({
4
- container: {
5
- flexDirection: 'row',
6
- justifyContent: 'space-between',
7
- backgroundColor: COLORS.BRAND_WHITE,
8
- paddingVertical: 10,
9
- alignItems: 'flex-start',
10
- gap: 10,
11
- },
12
- imageAndDetails: {
13
- flexDirection: 'row',
14
- flexShrink: 1,
15
- alignItems: 'flex-start',
16
- gap: 10,
17
- },
18
- image: {
19
- marginBottom: 4,
20
- marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
21
- },
22
- icon: {
23
- marginBottom: 4,
24
- marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
25
- },
26
- headlineAndTimestampBlockContainer: {
27
- flexShrink: 1,
28
- flexGrow: 1,
29
- gap: 4,
30
- justifyContent: 'space-between',
31
- },
32
- sectionName: {
33
- color: COLORS.BRAND_1,
34
- fontSize: FONT_SIZE.h4,
35
- lineHeight: FONT_SIZE.h4 * lineHeightMultiplier,
36
- },
37
- headline: {
38
- color: COLORS.BRAND_BLACK,
39
- flexWrap: 'wrap',
40
- fontSize: FONT_SIZE.h3,
41
- fontFamily: FONT_FAMILY.primaryBold,
42
- lineHeight: FONT_SIZE.h3 * lineHeightMultiplier,
43
- marginBottom: 4,
44
- },
45
- storyTypeContainer: {
46
- position: 'absolute',
47
- bottom: 0,
48
- left: 0,
49
- },
50
- premiumIcon: {
51
- marginTop: FONT_SIZE.h3 * 0.45,
52
- marginRight: 3,
53
- },
54
- separatorLine: {
55
- height: 0.8,
56
- opacity: 0.1,
57
- backgroundColor: COLORS.BRAND_BLACK,
58
- },
59
- });