@quintype/native-components 2.20.0-fix-rtl-issues.1 → 2.20.0

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 (52) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/package.json +7 -8
  3. package/src/Icons/ClockIcon/index.js +9 -5
  4. package/src/components/ActionText/ActionText.js +7 -9
  5. package/src/components/ActionText/ActionText.test.js +5 -12
  6. package/src/components/AlsoRead/index.js +1 -1
  7. package/src/components/AlsoRead/styles.js +2 -0
  8. package/src/components/AuthorRow/AuthorRow.test.js +4 -9
  9. package/src/components/AuthorRow/index.js +16 -12
  10. package/src/components/BackNavigator/styles.js +2 -0
  11. package/src/components/Button/index.js +13 -9
  12. package/src/components/CollectionCard/index.js +6 -1
  13. package/src/components/CollectionCardNew/index.js +5 -1
  14. package/src/components/CollectionTitleNew/styles.js +0 -1
  15. package/src/components/CustomSwitch/index.js +16 -10
  16. package/src/components/Header/index.js +13 -9
  17. package/src/components/JSEmbedElement/index.js +3 -1
  18. package/src/components/PDFReader/styles.js +1 -0
  19. package/src/components/PrimaryStoryCard/index.js +60 -24
  20. package/src/components/PrimaryStoryCard/styles.js +29 -5
  21. package/src/components/PrimaryStoryCardNew/index.js +67 -18
  22. package/src/components/PrimaryStoryCardNew/styles.js +29 -5
  23. package/src/components/RadioButton/index.js +24 -9
  24. package/src/components/SecondaryStoryCard/index.js +60 -22
  25. package/src/components/SecondaryStoryCard/styles.js +29 -4
  26. package/src/components/SecondaryStoryCardNew/index.js +68 -16
  27. package/src/components/SecondaryStoryCardNew/styles.js +28 -4
  28. package/src/components/ShareButton/index.js +8 -3
  29. package/src/components/SlideshowStoryCard/styles.js +3 -2
  30. package/src/components/Story/index.js +14 -10
  31. package/src/components/StoryHeader/index.js +9 -7
  32. package/src/components/StoryHeader/styles.js +4 -2
  33. package/src/components/StoryImage/index.js +1 -1
  34. package/src/components/StoryImage/styles.js +2 -2
  35. package/src/components/StoryText/index.js +3 -1
  36. package/src/components/StoryText/styles.js +2 -0
  37. package/src/components/Table/index.js +1 -1
  38. package/src/components/Table/styles.js +5 -2
  39. package/src/components/TextBigFact/index.js +1 -2
  40. package/src/components/TextBigFact/styles.js +3 -0
  41. package/src/components/TextBlockQuote/index.js +5 -4
  42. package/src/components/TextBlockQuote/styles.js +8 -0
  43. package/src/components/TextBlurb/styles.js +2 -0
  44. package/src/components/TextQandA/styles.js +3 -3
  45. package/src/components/TextQuote/styles.js +5 -2
  46. package/src/components/TextSummary/styles.js +2 -0
  47. package/src/components/YouTubePlayer/index.js +1 -0
  48. package/src/constants/component-constants/content-constants/constants.js +7 -5
  49. package/src/constants/component-constants/general-constants/constants.js +25 -14
  50. package/src/constants/renderHTML.js +10 -0
  51. package/src/utils/story.js +7 -3
  52. package/src/utils/timeUtils.js +13 -4
@@ -1,16 +1,27 @@
1
+ import { I18nManager } from 'react-native';
2
+
1
3
  export const COMP_GENERAL_CONSTANTS = {
2
- secondaryStoryCard: 'COMP_GENERAL_SECONDARY_STORY',
3
- primaryStoryCard: 'COMP_GENERAL_PRIMARY_STORY',
4
- secondaryStoryAuthor: 'COMP_GENERAL_SECONDARY_STORY_AUTHOR',
5
- secondaryStoryPubishedAt: 'COMP_GENERAL_SECONDARY_STORY_PUBLISHEDATE',
6
- primaryStoryAuthor: 'COMP_GENERAL_PRIMARY_STORY_AUTHOR',
7
- primaryStoryPubishedAt: 'COMP_GENERAL_PRIMARY_STORY_PUBLISHEDATE',
8
- secondaryStoryHeadline: 'COMP_GENERAL_SECONDARY_STORY_HEADLINE',
9
- primaryStoryHeadline: 'COMP_GENERAL_PRIMARY_STORY_HEADLINE',
10
- iconTextTouch: 'COMP_GENERAL_ICON_TEXT_TOUCH',
11
- iconTextLabel: 'COMP_GENERAL_ICON_TEXT_LABEL',
12
- collectionTitleTouch: 'COMP_GENERAL_COLLECTION_TITLE',
13
- collectionTitleText: 'COMP_GENERAL_COLLECTION_TITLE_TEXT',
14
- backNavigatorText: 'COMP_GENERAL_BACK_NAVIGATOR_TEXT',
15
- backNavigatorTouch: 'COMP_GENERAL_BACK_NAVIGATOR_TOUCH',
4
+ secondaryStoryCard: "COMP_GENERAL_SECONDARY_STORY",
5
+ primaryStoryCard: "COMP_GENERAL_PRIMARY_STORY",
6
+ secondaryStoryAuthor: "COMP_GENERAL_SECONDARY_STORY_AUTHOR",
7
+ secondaryStoryPubishedAt: "COMP_GENERAL_SECONDARY_STORY_PUBLISHEDATE",
8
+ primaryStoryAuthor: "COMP_GENERAL_PRIMARY_STORY_AUTHOR",
9
+ primaryStoryPubishedAt: "COMP_GENERAL_PRIMARY_STORY_PUBLISHEDATE",
10
+ secondaryStoryHeadline: "COMP_GENERAL_SECONDARY_STORY_HEADLINE",
11
+ primaryStoryHeadline: "COMP_GENERAL_PRIMARY_STORY_HEADLINE",
12
+ iconTextTouch: "COMP_GENERAL_ICON_TEXT_TOUCH",
13
+ iconTextLabel: "COMP_GENERAL_ICON_TEXT_LABEL",
14
+ collectionTitleTouch: "COMP_GENERAL_COLLECTION_TITLE",
15
+ collectionTitleText: "COMP_GENERAL_COLLECTION_TITLE_TEXT",
16
+ backNavigatorText: "COMP_GENERAL_BACK_NAVIGATOR_TEXT",
17
+ backNavigatorTouch: "COMP_GENERAL_BACK_NAVIGATOR_TOUCH",
18
+ customSwitch: "COMP_GENERAL_CUSTOM_SWITCH",
19
+ primaryStoryReadTime: "COMP_GENERAL_PRIMARY_STORY_READTIME",
20
+ secondaryStoryReadTime: "COMP_GENERAL_SECONDARY_STORY_READTIME",
21
+ actionTextTouch: "COMP_GENERAL_ACTION_TEXT_TOUCH",
22
+ buttonTouch: "COMP_GENERAL_BUTTON_TOUCH",
23
+ headerLogoTouch: "COMP_GENERAL_HEADER_LOGO_TOUCH",
24
+ radioButtonTouch: "COMP_GENERAL_RADIO",
25
+ shareButtonTouch: "COMP_GENERAL_SHARE",
26
+ textAlignment: I18nManager.isRTL ? "left" : "auto",
16
27
  };
@@ -59,5 +59,15 @@ export const customHTMLStyles = () => {
59
59
  color: COLORS.BRAND_BLACK,
60
60
  opacity: 0.85,
61
61
  },
62
+ sup: {
63
+ marginBottom: 16,
64
+ lineHeight: FONT_SIZE.p1 * 0.3,
65
+ fontSize: FONT_SIZE.p1 * 0.5,
66
+ },
67
+ sub: {
68
+ marginBottom: 16,
69
+ lineHeight: FONT_SIZE.p1 * 0.3,
70
+ fontSize: FONT_SIZE.p1 * 0.5,
71
+ },
62
72
  };
63
73
  };
@@ -7,10 +7,14 @@ import get from 'lodash/get';
7
7
  */
8
8
 
9
9
  export const isStoryFree = (story = {}) => {
10
- if (!('access' in story)) {
11
- return true;
10
+ switch (story.access) {
11
+ case 'login':
12
+ return 1;
13
+ case 'subscription':
14
+ return 2;
15
+ default:
16
+ return 0;
12
17
  }
13
- return story.access === 'public' || Object.is(story.access, null);
14
18
  };
15
19
 
16
20
  /**
@@ -1,9 +1,9 @@
1
- import { formatDistanceToNow, differenceInMinutes, format as dateFormat } from 'date-fns';
1
+ import { formatDistanceToNowStrict, differenceInMinutes, format as dateFormat } from 'date-fns';
2
2
  import * as dateFNSlocale from 'date-fns/locale';
3
3
 
4
4
  export function getTimeAgo(date) {
5
5
  if (date) {
6
- return formatDistanceToNow(new Date(date));
6
+ return formatDistanceToNowStrict(new Date(date));
7
7
  }
8
8
  return '';
9
9
  }
@@ -15,14 +15,23 @@ export function getTimeInFormat(date, format, localTime) {
15
15
  return '';
16
16
  }
17
17
 
18
- export const getTimeForStoryCards = (date, format, localTime) => {
18
+ export const getTimeForStoryCards = (
19
+ date,
20
+ format,
21
+ localTime,
22
+ translate,
23
+ reverseTimeAdverbPosition = false,
24
+ ) => {
19
25
  if (date) {
20
26
  const currentDate = new Date();
21
27
  const dateToFormat = new Date(date);
22
28
  const locale = dateFNSlocale[localTime];
23
29
  const distanceInMinutes = differenceInMinutes(currentDate, dateToFormat);
24
30
  if (distanceInMinutes <= 1440) {
25
- return `published ${formatDistanceToNow(dateToFormat, { locale })} ago`;
31
+ const timeDistance = formatDistanceToNowStrict(dateToFormat, { locale });
32
+ return reverseTimeAdverbPosition
33
+ ? `${translate('ago')} ${timeDistance}`
34
+ : `${timeDistance} ${translate('ago')}`;
26
35
  }
27
36
  return dateFormat(dateToFormat, format, { locale });
28
37
  }