@momo-kits/badge 0.0.46-beta.52 → 0.0.46-beta.56

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 (3) hide show
  1. package/index.js +11 -3
  2. package/package.json +3 -5
  3. package/publish.sh +2 -3
package/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
- import { Colors, Spacing, Text, Radius } from '@momo-kits/core';
3
+ import { Colors, Radius, Spacing, Text } from '@momo-kits/core';
4
+ import { isNumber } from 'lodash';
4
5
 
5
- const Badge = ({ type, value, style, textStyle, containerWidth }) => {
6
+ const Badge = ({ type, title, style, textStyle, containerWidth }) => {
6
7
  const getStyle = (type) => {
7
8
  switch (type) {
8
9
  case 'badge':
@@ -21,13 +22,20 @@ const Badge = ({ type, value, style, textStyle, containerWidth }) => {
21
22
  }
22
23
  };
23
24
 
25
+ const formatTitle = (title) => {
26
+ if (isNumber(title) && title > 99) {
27
+ return '99+';
28
+ }
29
+ return title;
30
+ };
31
+
24
32
  return (
25
33
  <View style={[getStyle(type), style]}>
26
34
  {type === 'badge' && (
27
35
  <Text
28
36
  weight="medium"
29
37
  style={[{ fontSize: 10, color: Colors.white }, textStyle]}>
30
- {value > 99 ? '99+' : value}
38
+ {formatTitle(title)}
31
39
  </Text>
32
40
  )}
33
41
  </View>
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "@momo-kits/badge",
3
- "version": "0.0.46-beta.52",
3
+ "version": "0.0.46-beta.56",
4
4
  "private": false,
5
5
  "main": "index.js",
6
- "dependencies": {},
7
6
  "peerDependencies": {
7
+ "react": "16.9.0",
8
8
  "react-native": ">=0.55",
9
9
  "prop-types": "^15.7.2",
10
- "react": "16.9.0",
11
- "@momo-kits/core": ">=0.0.5-beta",
12
- "lodash": "^4.17.15"
10
+ "@momo-kits/core": ">=0.0.5-beta"
13
11
  },
14
12
  "devDependencies": {},
15
13
  "license": "MoMo"
package/publish.sh CHANGED
@@ -9,7 +9,7 @@ VERSIONSTRING=( v$(jq .version package.json) )
9
9
  VERSION=(${VERSIONSTRING//[\"]/})
10
10
  echo VERSION: $VERSION
11
11
 
12
- rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' --exclude 'web.js' ./* dist
12
+ rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
13
13
 
14
14
  # #babel component to dist
15
15
  #babel ./dist -d dist --copy-files
@@ -25,5 +25,4 @@ npm publish --tag beta --access=public
25
25
  cd ..
26
26
  rm -rf dist
27
27
 
28
-
29
- #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/avatar new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/avatar"}'
28
+ #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/bank new version release: '*"$VERSION"*' `https://www.npmjs.com/package/@momo-kits/bank`"}'