@quintype/native-components 2.20.27 → 2.20.28-beta.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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.20.28](https://github.com/quintype/native-components/compare/v2.20.27...v2.20.28) (2024-05-17)
6
+
5
7
  ### [2.20.27](https://github.com/quintype/native-components/compare/v2.20.26...v2.20.27) (2024-05-17)
6
8
 
7
9
  ### [2.20.26](https://github.com/quintype/native-components/compare/v2.20.25...v2.20.26) (2024-05-17)
@@ -1,15 +1,15 @@
1
- #!/bin/bash -e
1
+ # #!/bin/bash -e
2
2
 
3
- npm install
4
- git diff --quiet
3
+ # npm install
4
+ # git diff --quiet
5
5
 
6
- BRANCH=$(git symbolic-ref --short HEAD)
6
+ # BRANCH=$(git symbolic-ref --short HEAD)
7
7
 
8
- if [ "$BRANCH" == 'master' ]
9
- then
10
- npx standard-version
11
- else
12
- npx standard-version --prerelease "$(git symbolic-ref --short HEAD | sed s:/:-:g )" --skip.changelog=true
13
- fi
8
+ # if [ "$BRANCH" == 'master' ]
9
+ # then
10
+ # npx standard-version
11
+ # else
12
+ # npx standard-version --prerelease "$(git symbolic-ref --short HEAD | sed s:/:-:g )" --skip.changelog=true
13
+ # fi
14
14
 
15
- git push --follow-tags origin "$BRANCH"
15
+ # git push --follow-tags origin "$BRANCH"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.20.27",
3
+ "version": "2.20.28-beta.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -23,7 +23,8 @@
23
23
  "react-native-pdf": "^5.1.4",
24
24
  "react-native-render-html": "^4.2.3",
25
25
  "react-native-share": "^8.1.0",
26
- "rn-fetch-blob": "^0.10.16"
26
+ "rn-fetch-blob": "^0.10.16",
27
+ "react-native-star-rating-widget": "^1.7.3"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "@react-navigation/native": ">=5.7.3",
@@ -0,0 +1,45 @@
1
+ import PropTypes from "prop-types";
2
+ import React, { useContext } from "react";
3
+ import { View } from "react-native";
4
+ import { Text } from "../Text";
5
+ import {ratingStyles} from './styles'
6
+ import { AppTheme } from "../../utils";
7
+ import { StarRatingDisplay } from 'react-native-star-rating-widget';
8
+
9
+ export const RatingLayout = ({ reviewTitle, ratingValue, ratingLabel }) => {
10
+ const { theme } = useContext(AppTheme);
11
+ const {
12
+ COLORS, FONT_FAMILY, FONT_SIZE
13
+ } = theme;
14
+ const styles = ratingStyles(COLORS, FONT_SIZE, FONT_FAMILY);
15
+
16
+ return (
17
+ <View style={styles.container}>
18
+ {reviewTitle && <Text
19
+ style={styles.reviewTitle}
20
+ >
21
+ {reviewTitle}
22
+ </Text>}
23
+ {ratingValue && <View style={styles.child}>
24
+ <Text
25
+ style={styles.ratingLable}
26
+ >
27
+ {`${ratingLabel}/5`}
28
+ </Text>
29
+ <StarRatingDisplay
30
+ rating={ratingValue}
31
+ starSize={FONT_SIZE.title}
32
+ color={COLORS.REVIEW_STAR_COLOR ?? '#F5A623'}
33
+ style={styles.starContiner}
34
+ starStyle={styles.starStyle}
35
+ />
36
+ </View>}
37
+ </View>
38
+ );
39
+ };
40
+
41
+ RatingLayout.propTypes = {
42
+ reviewTitle: PropTypes.string.isRequired,
43
+ ratingValue: PropTypes.number.isRequired,
44
+ ratingLabel: PropTypes.string.isRequired
45
+ };
@@ -0,0 +1,23 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const ratingStyles = (COLORS, FONT_SIZE, FONT_FAMILY) => StyleSheet.create({
4
+ container: { marginLeft: 10, marginTop: 10 },
5
+ reviewTitle: {
6
+ fontSize: FONT_SIZE.h2,
7
+ fontWeight: "700",
8
+ lineHeight: 24,
9
+ fontFamily: FONT_FAMILY.primary,
10
+ color: COLORS.BRAND_BLACK,
11
+ marginBottom:7
12
+ },
13
+ child: { display: "flex", flexDirection: "row", alignItems: "center"},
14
+ ratingLabel: {
15
+ fontSize: FONT_SIZE.h2,
16
+ fontWeight: "700",
17
+ lineHeight: 24,
18
+ fontFamily: FONT_FAMILY.secondary,
19
+ color: COLORS.BRAND_BLACK,
20
+ },
21
+ starContainer: { marginLeft: 10 },
22
+ starStyle: { marginHorizontal: 0 }
23
+ });
@@ -9,6 +9,7 @@ import {
9
9
  TouchableOpacityProps,
10
10
  } from 'react-native';
11
11
  import Icon from 'react-native-vector-icons/FontAwesome';
12
+ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
12
13
  import {
13
14
  AppTheme,
14
15
  getImageMetadata,
@@ -74,6 +75,12 @@ const SecondaryStoryCardNewBase = (props) => {
74
75
  </View>
75
76
  );
76
77
 
78
+ const showMaterialIcon = (name) => (
79
+ <View style={styles.storyType}>
80
+ <MaterialIcon name={name} size={14} color={COLORS.MONO7}/>
81
+ </View>
82
+ )
83
+
77
84
  const showStoryType = () => {
78
85
  switch (story['story-template']) {
79
86
  case 'text':
@@ -84,6 +91,8 @@ const SecondaryStoryCardNewBase = (props) => {
84
91
  return showIcon('play');
85
92
  case 'live-blog':
86
93
  return showLiveBlogIcon();
94
+ case 'review':
95
+ return showMaterialIcon('star-face')
87
96
  default:
88
97
  null;
89
98
  }
@@ -18,6 +18,7 @@ import { storyHeaderStyles } from './styles';
18
18
  import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
19
19
 
20
20
  import { DailyMotionPlayer } from '../DailyMotionPlayer';
21
+ import { RatingLayout } from '../Rating';
21
22
  const getHeroImage = (cdn, story) => {
22
23
  const imageSlug = story['hero-image-s3-key'];
23
24
  if (!imageSlug) return null;
@@ -73,7 +74,8 @@ export const StoryHeader = (props) => {
73
74
  const caption = story['hero-image-caption'];
74
75
  const attribution = story['hero-image-attribution'];
75
76
  const isPremiumStory = story['access'] === 'subscription';
76
-
77
+ const reviewTitle = story['metadata'] && story['metadata']['review-title'];
78
+ const reviewData = story['metadata'] && story['metadata']['review-rating'];
77
79
 
78
80
  const showAttribution = () => {
79
81
  if (!caption && !attribution) {
@@ -128,6 +130,7 @@ export const StoryHeader = (props) => {
128
130
  cdn={props.cdn}
129
131
  readtime={story['read-time']}
130
132
  />
133
+ {reviewTitle && <RatingLayout reviewTitle={reviewTitle} ratingValue={reviewData?.value} ratingLabel={reviewData?.label}/>}
131
134
  </View>
132
135
  );
133
136
  };