@impulse-ui-native/icon 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/icon",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -21,14 +21,9 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "dependencies": {
24
- "@fortawesome/fontawesome-svg-core": "^7.1.0",
25
- "@fortawesome/free-brands-svg-icons": "^7.1.0",
26
- "@fortawesome/free-regular-svg-icons": "^7.1.0",
27
- "@fortawesome/free-solid-svg-icons": "^7.1.0",
28
- "@fortawesome/react-native-fontawesome": "^0.3.2",
29
24
  "react-native-svg": "^15.14.0",
30
- "@impulse-ui-native/theme": "1.0.1",
31
- "@impulse-ui-native/core": "1.0.1"
25
+ "@impulse-ui-native/core": "1.0.3",
26
+ "@impulse-ui-native/theme": "1.0.3"
32
27
  },
33
28
  "peerDependencies": {
34
29
  "@fortawesome/free-brands-svg-icons": "^7.1.0",
@@ -1,27 +1,23 @@
1
- import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
2
- import { useTheme } from "@impulse-ui-native/theme";
3
- import { memo, PropsWithChildren, useMemo } from "react";
1
+ import { memo, useMemo } from "react";
4
2
  import { IconProps } from "../types";
5
3
 
6
4
  export const Icon = memo(function Icon({
7
5
  size = "medium",
8
6
  icon,
9
- children,
10
- style,
11
7
  ...props
12
- }: PropsWithChildren<IconProps>) {
13
- const theme = useTheme();
14
- const iconSize = useMemo(
15
- () =>
16
- ({
17
- small: 14,
18
- medium: 16,
19
- large: 16,
20
- }[size]),
21
- [theme, size]
22
- );
8
+ }: IconProps) {
9
+ const Icon = icon;
23
10
 
24
- return (
25
- <FontAwesomeIcon size={iconSize} icon={icon} style={style} {...props} />
26
- );
11
+ const iconSize =
12
+ useMemo(
13
+ () =>
14
+ ({
15
+ small: 14,
16
+ medium: 16,
17
+ large: 16,
18
+ }[size]),
19
+ [size]
20
+ ) ?? 16;
21
+
22
+ return <Icon width={iconSize} height={iconSize} {...props} />;
27
23
  });
@@ -1,11 +1,19 @@
1
- import { Props } from "@fortawesome/react-native-fontawesome";
2
1
  import { ComponentSize } from "@impulse-ui-native/theme";
2
+ import { ComponentType } from "react";
3
3
  import { ViewStyle } from "react-native";
4
4
 
5
5
  export interface IconStyle extends ViewStyle {
6
6
  color?: string;
7
7
  }
8
8
 
9
- export interface IconProps extends Omit<Props, "size"> {
9
+ export interface IconSvgProps {
10
+ width: number;
11
+ height: number;
12
+ color?: string;
13
+ }
14
+
15
+ export interface IconProps {
10
16
  size?: ComponentSize | number;
17
+ color?: string;
18
+ icon: ComponentType<IconSvgProps>;
11
19
  }