@quintype/native-components 2.19.20 → 2.19.26

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/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.19.26](https://github.com/quintype/native-components/compare/v2.19.25...v2.19.26) (2022-12-16)
6
+
7
+ ### [2.19.25](https://github.com/quintype/native-components/compare/v2.19.24...v2.19.25) (2022-12-07)
8
+
9
+ ### [2.19.24](https://github.com/quintype/native-components/compare/v2.19.23...v2.19.24) (2022-12-06)
10
+
11
+ ### [2.19.23](https://github.com/quintype/native-components/compare/v2.19.22...v2.19.23) (2022-12-06)
12
+
13
+ ### [2.19.22](https://github.com/quintype/native-components/compare/v2.19.21...v2.19.22) (2022-12-06)
14
+
15
+ ### [2.19.21](https://github.com/quintype/native-components/compare/v2.19.20...v2.19.21) (2022-11-18)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **fonts:** Fixes fonts for CollectionTitle and Caption/Attribution HTML 🔨 ([#188](https://github.com/quintype/native-components/issues/188)) ([94c61ff](https://github.com/quintype/native-components/commit/94c61ff385df2225f6a3d1b14c1f5d2ce3a1ed89))
21
+
5
22
  ### [2.19.20](https://github.com/quintype/native-components/compare/v2.19.19...v2.19.20) (2022-11-07)
6
23
 
7
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.19.20",
3
+ "version": "2.19.26",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -13,7 +13,6 @@ export const collectionTitleStyles = (appThemeContext) => {
13
13
  },
14
14
  title: {
15
15
  fontSize: FONT_SIZE.h3,
16
- fontWeight: 'bold',
17
16
  color: COLORS.BRAND_5,
18
17
  },
19
18
  });
@@ -43,5 +43,6 @@ export const pdfStyles = (COLORS, FONT_SIZE, DARK_MODE) => StyleSheet.create({
43
43
  width: '20%',
44
44
  justifyContent: 'center',
45
45
  alignItems: 'center',
46
+ margin : 10
46
47
  },
47
48
  });
@@ -24,7 +24,7 @@ export const PrimaryStoryCard = (props) => {
24
24
 
25
25
  const translate = get(theme, ["translate"], (word) => word);
26
26
 
27
- const { COLORS, FONT_SIZE, locale } = theme || {};
27
+ const { COLORS, FONT_SIZE, locale, reverseTimeAdverbPosition } = theme || {};
28
28
 
29
29
  const DATE_FORMAT = "d MMM, yyyy";
30
30
 
@@ -110,7 +110,8 @@ export const PrimaryStoryCard = (props) => {
110
110
  story["published-at"],
111
111
  DATE_FORMAT,
112
112
  locale,
113
- translate
113
+ translate,
114
+ reverseTimeAdverbPosition
114
115
  )}
115
116
  </Text>
116
117
  <Text
@@ -21,7 +21,7 @@ const PrimaryStoryCardNewBase = (props) => {
21
21
  const { story = {} } = props;
22
22
  const { theme } = useContext(AppTheme);
23
23
  const {
24
- COLORS, FONT_SIZE, locale, DARK_MODE,
24
+ COLORS, FONT_SIZE, locale, DARK_MODE, reverseTimeAdverbPosition,
25
25
  } = theme || {};
26
26
 
27
27
  const translate = get(theme, ['translate'], (word) => word);
@@ -111,6 +111,7 @@ const PrimaryStoryCardNewBase = (props) => {
111
111
  DATE_FORMAT,
112
112
  locale,
113
113
  translate,
114
+ reverseTimeAdverbPosition,
114
115
  )}
115
116
  </Text>
116
117
  </View>
@@ -29,7 +29,7 @@ export const SecondaryStoryCard = (props) => {
29
29
  const { theme } = useContext(AppTheme);
30
30
  const translate = get(theme, ["translate"], (word) => word);
31
31
 
32
- const { locale, COLORS } = theme;
32
+ const { locale, COLORS, reverseTimeAdverbPosition } = theme;
33
33
  const styles = secStoryCardStyles(theme);
34
34
  const { story = {} } = props;
35
35
 
@@ -131,7 +131,8 @@ export const SecondaryStoryCard = (props) => {
131
131
  story["published-at"],
132
132
  DATE_FORMAT,
133
133
  locale,
134
- translate
134
+ translate,
135
+ reverseTimeAdverbPosition
135
136
  )}
136
137
  </Text>
137
138
  <View style={iconStyles}>{props.iconComponent}</View>
@@ -27,7 +27,7 @@ import {
27
27
  const SecondaryStoryCardNewBase = (props) => {
28
28
  const { story = {} } = props;
29
29
  const { theme } = useContext(AppTheme);
30
- const { locale, DARK_MODE, COLORS } = theme;
30
+ const { locale, DARK_MODE, COLORS, reverseTimeAdverbPosition } = theme;
31
31
 
32
32
  const translate = get(theme, ["translate"], (word) => word);
33
33
 
@@ -116,7 +116,8 @@ const SecondaryStoryCardNewBase = (props) => {
116
116
  story["published-at"],
117
117
  DATE_FORMAT,
118
118
  locale,
119
- translate
119
+ translate,
120
+ reverseTimeAdverbPosition
120
121
  )}
121
122
  </Text>
122
123
  </View>
@@ -1,5 +1,5 @@
1
1
  import { StyleSheet, Dimensions } from 'react-native';
2
-
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants'
3
3
  const { width } = Dimensions.get('window');
4
4
 
5
5
  export const slideshowStoryCardStyles = ({ COLORS }) => {
@@ -21,7 +21,8 @@ export const slideshowStoryCardStyles = ({ COLORS }) => {
21
21
  flexDirection: 'column',
22
22
  },
23
23
  attributionText: {
24
- color: COLORS.BRAND_BLACK
24
+ color: COLORS.BRAND_BLACK,
25
+ textAlign : COMP_GENERAL_CONSTANTS.textAlignment
25
26
  }
26
27
  })
27
28
  }
@@ -69,8 +69,10 @@ export const StoryHeader = (props) => {
69
69
  const { story } = props;
70
70
  const sectionData = get(story, ['sections', 0], {});
71
71
  const { theme } = useContext(AppTheme);
72
- const { COLORS, CAN_COPY_TEXT, locale } = theme;
73
- const styles = storyHeaderStyles(COLORS);
72
+ const {
73
+ COLORS, CAN_COPY_TEXT, locale, FONT_FAMILY,
74
+ } = theme;
75
+ const styles = storyHeaderStyles(COLORS, FONT_FAMILY);
74
76
  const imgCaption = story['hero-image-caption'];
75
77
  const attri = story['hero-image-attribution'];
76
78
  const imgAttribution = imgCaption && attri ? ` | ${attri}` : attri;
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
- export const storyHeaderStyles = (COLORS) => StyleSheet.create({
3
+ export const storyHeaderStyles = (COLORS, FONT_FAMILY) => StyleSheet.create({
4
4
  tagStyle: {
5
5
  padding: 10,
6
6
  backgroundColor: COLORS.BRAND_7,
@@ -29,10 +29,12 @@ export const storyHeaderStyles = (COLORS) => StyleSheet.create({
29
29
  padding: 10,
30
30
  paddingBottom: 0,
31
31
  color: COLORS.BRAND_BLACK,
32
+ fontFamily: FONT_FAMILY.secondary,
32
33
  opacity: 0.8,
33
34
  },
34
35
  attributionStyle: {
35
36
  color: COLORS.BRAND_BLACK,
37
+ fontFamily: FONT_FAMILY.secondary,
36
38
  opacity: 0.8,
37
39
  },
38
40
  captionContainerStyle: {
@@ -1,4 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
2
3
 
3
4
  export const storyTextStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
4
5
  container: {
@@ -8,5 +9,6 @@ export const storyTextStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
8
9
  fontSize: FONT_SIZE.h2,
9
10
  lineHeight: FONT_SIZE.h2 * 1.5,
10
11
  color: COLORS.BRAND_8,
12
+ textAlign: COMP_GENERAL_CONSTANTS.textAlignment,
11
13
  },
12
14
  });
@@ -40,8 +40,7 @@ export const TextBigFact = ({ text, attribution, id }) => {
40
40
  />
41
41
  {!!attribution && (
42
42
  <Text style={styles.authorText}>
43
- -
44
- {attribution}
43
+ {`- ${attribution}`}
45
44
  </Text>
46
45
  )}
47
46
  </View>
@@ -1,4 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants'
2
3
 
3
4
  export const bigTextStyles = (COLORS, FONT_SIZE, DARK_MODE) => StyleSheet.create({
4
5
  container: {
@@ -16,5 +17,6 @@ export const bigTextStyles = (COLORS, FONT_SIZE, DARK_MODE) => StyleSheet.create
16
17
  fontSize: FONT_SIZE.h5,
17
18
  color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_WHITE,
18
19
  lineHeight: FONT_SIZE.h5 * 1.3,
20
+ textAlign : COMP_GENERAL_CONSTANTS.textAlignment
19
21
  },
20
22
  });
@@ -26,8 +26,10 @@ export const TextBlockQuote = ({ text, attribution }) => {
26
26
 
27
27
  return (
28
28
  <View testID="text-block-quote" style={styles.container}>
29
- <Icon name="quote-left" size={46} color={DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_WHITE} />
30
- <HTML
29
+ <View style={styles.topBorderContainer}>
30
+ <Icon name="quote-left" size={46} color={DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_WHITE} />
31
+ </View>
32
+ <HTML
31
33
  alterData={alterQuoteData}
32
34
  html={text}
33
35
  textSelectable={CAN_COPY_TEXT}
@@ -44,8 +46,7 @@ export const TextBlockQuote = ({ text, attribution }) => {
44
46
  />
45
47
  {!!attribution && (
46
48
  <Text style={styles.authorText}>
47
- -
48
- {attribution}
49
+ {`- ${attribution}`}
49
50
  </Text>
50
51
  )}
51
52
  </View>
@@ -1,4 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
2
3
 
3
4
  export const blockQuoteTextStyles = (FONT_SIZE, COLORS, DARK_MODE) => StyleSheet.create({
4
5
  container: {
@@ -11,10 +12,17 @@ export const blockQuoteTextStyles = (FONT_SIZE, COLORS, DARK_MODE) => StyleSheet
11
12
  color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_WHITE,
12
13
  lineHeight: FONT_SIZE.h1 * 1.3,
13
14
  marginVertical: 10,
15
+ textAlign: COMP_GENERAL_CONSTANTS.textAlignment,
14
16
  },
15
17
  authorText: {
16
18
  fontSize: FONT_SIZE.h5,
17
19
  color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_WHITE,
18
20
  lineHeight: FONT_SIZE.h5 * 1.3,
21
+ textAlign: COMP_GENERAL_CONSTANTS.textAlignment,
22
+ },
23
+ topBorderContainer: {
24
+ alignItems: 'center',
25
+ flexDirection: 'row',
26
+ marginBottom: 8,
19
27
  },
20
28
  });
@@ -1,4 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants'
2
3
 
3
4
  export const textBlurbStyles = (FONT_SIZE) => StyleSheet.create({
4
5
  container: {
@@ -9,5 +10,6 @@ export const textBlurbStyles = (FONT_SIZE) => StyleSheet.create({
9
10
  blurbText: {
10
11
  fontSize: FONT_SIZE.h3,
11
12
  lineHeight: FONT_SIZE.h3 * 1.3,
13
+ textAlign : COMP_GENERAL_CONSTANTS.textAlignment
12
14
  },
13
15
  });
@@ -1,4 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
2
3
 
3
4
  export const textQuoteStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
4
5
  container: {
@@ -19,14 +20,15 @@ export const textQuoteStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
19
20
  fontSize: FONT_SIZE.h1,
20
21
  lineHeight: FONT_SIZE.h1 * 1.3,
21
22
  color: COLORS.BRAND_BLACK,
22
- opacity: 0.9
23
+ opacity: 0.9,
24
+ textAlign: COMP_GENERAL_CONSTANTS.textAlignment,
23
25
  },
24
26
  attributionText: {
25
27
  fontSize: FONT_SIZE.h3,
26
28
  lineHeight: FONT_SIZE.h3 * 1.3,
27
29
  color: COLORS.BRAND_BLACK,
28
30
  alignItems: 'flex-end',
29
- textAlign: 'right',
31
+ textAlign: COMP_GENERAL_CONSTANTS.textAlignment,
30
32
  },
31
33
  quoteTopBorder: {
32
34
  backgroundColor: COLORS.BRAND_1,
@@ -43,5 +45,6 @@ export const textQuoteStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
43
45
  marginVertical: 10,
44
46
  alignSelf: 'flex-end',
45
47
  flexDirection: 'row',
48
+ width: '100%',
46
49
  },
47
50
  });
@@ -1,4 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
+ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants'
2
3
 
3
4
  export const textSummaryStyles = (FONT_SIZE, COLORS) => StyleSheet.create({
4
5
  container: {
@@ -14,6 +15,7 @@ export const textSummaryStyles = (FONT_SIZE, COLORS) => StyleSheet.create({
14
15
  color: COLORS.BRAND_6,
15
16
  fontSize: FONT_SIZE.h2,
16
17
  lineHeight: FONT_SIZE.h2 * 1.3,
18
+ textAlign: COMP_GENERAL_CONSTANTS.textAlignment
17
19
  },
18
20
  summaryText: {
19
21
  color: COLORS.BRAND_1,
@@ -1,3 +1,5 @@
1
+ import { I18nManager } from 'react-native';
2
+
1
3
  export const COMP_GENERAL_CONSTANTS = {
2
4
  secondaryStoryCard: "COMP_GENERAL_SECONDARY_STORY",
3
5
  primaryStoryCard: "COMP_GENERAL_PRIMARY_STORY",
@@ -21,4 +23,5 @@ export const COMP_GENERAL_CONSTANTS = {
21
23
  headerLogoTouch: "COMP_GENERAL_HEADER_LOGO_TOUCH",
22
24
  radioButtonTouch: "COMP_GENERAL_RADIO",
23
25
  shareButtonTouch: "COMP_GENERAL_SHARE",
26
+ textAlignment: I18nManager.isRTL ? 'left' : 'right',
24
27
  };
@@ -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,16 +15,25 @@ export function getTimeInFormat(date, format, localTime) {
15
15
  return '';
16
16
  }
17
17
 
18
- export const getTimeForStoryCards = (date, format, localTime, translate) => {
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 `${translate("published")} ${formatDistanceToNow(dateToFormat, { locale })} ${translate("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
  }
29
- return '';
38
+ return "";
30
39
  };