@momo-kits/badge 0.153.2 → 0.154.1-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.
Files changed (3) hide show
  1. package/Badge.tsx +23 -7
  2. package/package.json +1 -1
  3. package/styles.ts +1 -3
package/Badge.tsx CHANGED
@@ -1,12 +1,18 @@
1
- import React, {FC, useContext} from 'react';
2
- import {View} from 'react-native';
1
+ import React, { FC, useContext } from 'react';
2
+ import { View } from 'react-native';
3
3
 
4
- import {BadgeProps} from './types';
4
+ import { BadgeProps } from './types';
5
5
  import styles from './styles';
6
- import {ApplicationContext, Colors, Text} from '@momo-kits/foundation';
6
+ import {
7
+ ApplicationContext,
8
+ Colors,
9
+ Text,
10
+ useScaleSize,
11
+ } from '@momo-kits/foundation';
7
12
 
8
- const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
9
- const {theme} = useContext(ApplicationContext);
13
+ const Badge: FC<BadgeProps> = ({ label = 'Label', style, backgroundColor }) => {
14
+ const { theme } = useContext(ApplicationContext);
15
+ const scaledSize = useScaleSize(16);
10
16
 
11
17
  const isValidatedColor = () => {
12
18
  const colorKeys = Object.keys(Colors);
@@ -43,7 +49,17 @@ const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
43
49
  }
44
50
 
45
51
  return (
46
- <View style={[style, styles.badge, {backgroundColor: badgeColor}]}>
52
+ <View
53
+ style={[
54
+ style,
55
+ styles.badge,
56
+ {
57
+ height: scaledSize,
58
+ minWidth: scaledSize,
59
+ },
60
+ { backgroundColor: badgeColor },
61
+ ]}
62
+ >
47
63
  <Text color={Colors.black_01} typography={'action_xxs_bold'}>
48
64
  {formatTitle()}
49
65
  </Text>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/badge",
3
- "version": "0.153.2",
3
+ "version": "0.154.1-beta.1",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
package/styles.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {Colors, Radius, scaleSize, Spacing} from '@momo-kits/foundation';
2
+ import {Colors, Radius, Spacing} from '@momo-kits/foundation';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  badge: {
@@ -7,8 +7,6 @@ export default StyleSheet.create({
7
7
  borderRadius: Radius.M,
8
8
  justifyContent: 'center',
9
9
  alignItems: 'center',
10
- height: scaleSize(16),
11
- minWidth: scaleSize(16),
12
10
  flexDirection: 'row',
13
11
  borderWidth: 1,
14
12
  borderColor: Colors.black_01,