Skip to content

Commit 1e1e19b

Browse files
committed
refactor: move icons to /Icons and add typed properties
1 parent 008bc63 commit 1e1e19b

20 files changed

+144
-216
lines changed

src/components/Icon/ActionDot.icon.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/components/Icon/CircleCheck.icon.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/components/Icon/CircleClock.icon.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/components/Icon/CircleError.icon.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/components/Icons/ActionDot.icon.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import { COLORS } from '../../styles/themes'
1111
import { DEFAULT_ICON_SIZE } from './constants'
1212
import { getScale, getViewBox } from './helper'
1313

14+
/**
15+
* @param {object} props
16+
* @property {number} props.size
17+
* @property {StyleSheet} props.color
18+
*/
1419
export const ActionDot = ({ size = DEFAULT_ICON_SIZE, color = COLORS.black }) => (
1520
<Svg
1621
xmlns='http://www.w3.org/2000/svg'

src/components/Icon/ArrowDown.icon.js renamed to src/components/Icons/ArrowDown.icon.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@
88
import * as React from 'react'
99
import { View, Image, StyleSheet } from 'react-native';
1010
import chevronDown from '../../assets/icons/chevron-down.png';
11+
import { DEFAULT_ICON_SIZE } from './constants';
1112

1213
/**
13-
* @typedef {Object} Properties prop
14-
* @property {StyleSheet} prop.style
15-
*
16-
* @param {Properties} properties
14+
* @param {object} props
15+
* @property {number} props.size
16+
* @property {StyleSheet} props.style
1717
*/
18-
export const ArrowDownIcon = ({ style }) => (
18+
export const ArrowDownIcon = ({ size = DEFAULT_ICON_SIZE, style }) => (
1919
<View style={[styles.wrapper, style]}>
20-
<Image source={chevronDown} width={24} height={24} />
20+
<Image
21+
source={chevronDown}
22+
width={size}
23+
height={size}
24+
/>
2125
</View>
2226
);
2327

src/components/Icon/ArrowUp.icon.js renamed to src/components/Icons/ArrowUp.icon.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@
88
import * as React from 'react'
99
import { View, Image, StyleSheet } from 'react-native';
1010
import chevronUp from '../../assets/icons/chevron-up.png';
11+
import { DEFAULT_ICON_SIZE } from './constants';
1112

1213
/**
13-
* @typedef {Object} Properties prop
14-
* @property {StyleSheet} prop.style
15-
*
16-
* @param {Properties} properties
14+
* @param {object} props
15+
* @property {number} props.size
16+
* @property {StyleSheet} props.style
1717
*/
18-
export const ArrowUpIcon = ({ style }) => (
18+
export const ArrowUpIcon = ({ size = DEFAULT_ICON_SIZE, style }) => (
1919
<View style={[styles.wrapper, style]}>
20-
<Image source={chevronUp} width={24} height={24} />
20+
<Image
21+
source={chevronUp}
22+
width={size}
23+
height={size}
24+
/>
2125
</View>
2226
);
2327

src/components/Icon/Base.icon.js renamed to src/components/Icons/Base.icon.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import { StyleSheet, View } from 'react-native';
99
import { COLORS } from '../../styles/themes';
1010

1111
/**
12-
* @typedef {Object} Base base
13-
* @property {'default'|'outline'|'fill'} base.type
14-
* @property {StyleSheet} base.style
15-
* @property {ReactNode} base.children
16-
*
17-
* @param {Base}
12+
* @param {object} props
13+
* @property {'default'|'outline'|'fill'} props.type
14+
* @property {StyleSheet} props.style
15+
* @property {ReactNode} props.children
1816
*/
19-
export const BaseIcon = ({ type, style, children }) => (
17+
export const BaseIcon = ({ type = 'default', style, children }) => (
2018
<View style={[
2119
styles[type],
2220
style

src/components/Icons/CircleCheck.icon.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ import { COLORS } from '../../styles/themes'
1111
import { DEFAULT_ICON_SIZE } from './constants'
1212
import { getScale, getViewBox } from './helper'
1313

14+
/**
15+
* @param {object} props
16+
* @property {number} props.size
17+
* @property {StyleSheet} props.color
18+
*
19+
* @description
20+
* Svg converted from Figma using transaformer at https://react-svgr.com/playground/?native=true
21+
*/
1422
export const CircleCheck = ({ size = DEFAULT_ICON_SIZE, color = COLORS.black }) => (
1523
<Svg
1624
xmlns='http://www.w3.org/2000/svg'

src/components/Icons/CircleClock.icon.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ import { COLORS } from '../../styles/themes'
1111
import { DEFAULT_ICON_SIZE } from './constants'
1212
import { getScale, getViewBox } from './helper'
1313

14+
/**
15+
* @param {object} props
16+
* @property {number} props.size
17+
* @property {StyleSheet} props.color
18+
*
19+
* @description
20+
* Svg converted from Figma using transaformer at https://react-svgr.com/playground/?native=true
21+
*/
1422
export const CircleClock = ({ size = DEFAULT_ICON_SIZE, color = COLORS.black }) => (
1523
<Svg
1624
xmlns='http://www.w3.org/2000/svg'

src/components/Icons/CircleError.icon.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ import { COLORS } from '../../styles/themes'
1111
import { DEFAULT_ICON_SIZE } from './constants'
1212
import { getScale, getViewBox } from './helper'
1313

14+
/**
15+
* @param {object} props
16+
* @property {number} props.size
17+
* @property {StyleSheet} props.color
18+
*
19+
* @description
20+
* Svg converted from Figma using transaformer at https://react-svgr.com/playground/?native=true
21+
*/
1422
export const CircleError = ({ size = DEFAULT_ICON_SIZE, color = COLORS.black }) => (
1523
<Svg
1624
xmlns='http://www.w3.org/2000/svg'

src/components/Icon/CircleInfo.icon.js renamed to src/components/Icons/CircleInfo.icon.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77

88
import * as React from 'react'
99
import Svg, { G, Path, Defs, ClipPath } from 'react-native-svg'
10+
import { COLORS } from '../../styles/themes';
1011

11-
export const CircleInfoIcon = ({ size = 20, color = '#000' }) => (
12+
/**
13+
* @param {object} props
14+
* @property {number} props.size
15+
* @property {StyleSheet} props.color
16+
*
17+
* @description
18+
* Svg converted from Figma using transaformer at https://react-svgr.com/playground/?native=true
19+
*/
20+
export const CircleInfoIcon = ({ size = 20, color = COLORS.white }) => (
1221
<Svg
1322
xmlns='http://www.w3.org/2000/svg'
1423
width={size}
@@ -25,7 +34,7 @@ export const CircleInfoIcon = ({ size = 20, color = '#000' }) => (
2534
</G>
2635
<Defs>
2736
<ClipPath id='a'>
28-
<Path fill='#fff' d='M0 0h20v20H0z' />
37+
<Path fill={color} d='M0 0h20v20H0z' />
2938
</ClipPath>
3039
</Defs>
3140
</Svg>

src/components/Icon/NanoContract.icon.js renamed to src/components/Icons/NanoContract.icon.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,31 @@
77

88
import * as React from 'react'
99
import Svg, { Path } from 'react-native-svg'
10+
import { COLORS } from '../../styles/themes';
1011
import { BaseIcon } from './Base.icon';
12+
import { DEFAULT_ICON_SIZE } from './constants';
1113

1214
/**
13-
* @param {SvgProps|{type: 'default'|'outline'|'fill'}} props
15+
* @param {object} props
16+
* @property {SvgProps|{type: 'default'|'outline'|'fill'}} props.type
17+
* @property {number} props.size
18+
* @property {StyleSheet} props.color
1419
*
1520
* @description
1621
* Svg converted from Figma using transaformer at https://react-svgr.com/playground/?native=true
1722
*/
18-
export const NanoContractIcon = (props) => (
19-
<BaseIcon type={props.type || 'default'}>
23+
export const NanoContractIcon = ({ type = 'default', size = DEFAULT_ICON_SIZE, color = COLORS.black }) => (
24+
<BaseIcon type={type}>
2025
<Svg
2126
xmlns='http://www.w3.org/2000/svg'
22-
width={24}
23-
height={24}
27+
width={size}
28+
height={size}
29+
viewBox={getViewBox(size)}
30+
transform={getScale(size, DEFAULT_ICON_SIZE)}
2431
fill='none'
25-
{...props}
2632
>
2733
<Path
28-
fill={props.color || '#000'}
34+
fill={color}
2935
d='M6.101 21.298a2.33 2.33 0 0 1-1.697-.69 2.278 2.278 0 0 1-.702-1.689v-1.198c0-.47.167-.871.501-1.205a1.644 1.644 0 0 1 1.206-.502H6.5V4.41c0-.47.167-.871.501-1.206a1.643 1.643 0 0 1 1.206-.501H18.59c.47 0 .871.167 1.206.501.334.335.501.736.501 1.206v14.51c0 .665-.234 1.228-.702 1.688a2.33 2.33 0 0 1-1.697.691H6.101ZM17.899 19.9c.283 0 .52-.094.712-.282a.938.938 0 0 0 .288-.698V4.41a.3.3 0 0 0-.087-.221.3.3 0 0 0-.22-.087H8.206a.3.3 0 0 0-.221.087.3.3 0 0 0-.087.22v11.606h7.314c.469 0 .87.168 1.205.502.334.334.501.736.501 1.205v1.198c0 .278.094.51.282.698.188.188.42.282.698.282ZM9.894 8.49a.676.676 0 0 1-.496-.205.674.674 0 0 1-.206-.494c0-.193.069-.357.206-.494a.677.677 0 0 1 .496-.206h7.015a.67.67 0 0 1 .49.206.671.671 0 0 1 .207.492c0 .194-.069.36-.206.496a.672.672 0 0 1-.491.205H9.894Zm0 2.885a.676.676 0 0 1-.496-.206.674.674 0 0 1-.206-.494c0-.192.069-.357.206-.494a.677.677 0 0 1 .496-.205h7.015a.67.67 0 0 1 .49.206.671.671 0 0 1 .207.491c0 .194-.069.36-.206.497a.671.671 0 0 1-.491.205H9.894Zm-3.791 8.524h9.417v-2.178a.3.3 0 0 0-.086-.221.3.3 0 0 0-.221-.087H5.409a.3.3 0 0 0-.221.087.3.3 0 0 0-.087.221v1.198c0 .278.096.51.288.698a.98.98 0 0 0 .714.282Zm-.005 0h-.997 10.42-9.423Z'
3036
/>
3137
</Svg>

src/components/Icon/Oracle.icon.js renamed to src/components/Icons/Oracle.icon.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,35 @@
77

88
import * as React from 'react'
99
import Svg, { Path } from 'react-native-svg'
10+
import { COLORS } from '../../styles/themes';
1011
import { BaseIcon } from './Base.icon';
12+
import { DEFAULT_ICON_SIZE } from './constants';
1113

1214
/**
13-
* @param {SvgProps|{type: 'default'|'outline'|'fill'}} props
15+
* @param {object} props
16+
* @property {SvgProps|{type: 'default'|'outline'|'fill'}} props.type
17+
* @property {number} props.size
18+
* @property {StyleSheet} props.color
1419
*
1520
* @description
1621
* Svg converted from Figma using transaformer at https://react-svgr.com/playground/?native=true
1722
*/
18-
export const OracleIcon = (props) => (
19-
<BaseIcon type={props.type || 'default'}>
23+
export const OracleIcon = ({ type = 'default', size = DEFAULT_ICON_SIZE, color = COLORS.black }) => (
24+
<BaseIcon type={type}>
2025
<Svg
2126
xmlns='http://www.w3.org/2000/svg'
22-
width={24}
23-
height={24}
27+
width={size}
28+
height={size}
29+
viewBox={getViewBox(size)}
30+
transform={getScale(size, DEFAULT_ICON_SIZE)}
2431
fill='none'
25-
{...props}
2632
>
2733
<Path
28-
fill={props.color || '#000'}
34+
fill={color}
2935
d='M12 20.5c-.096 0-.189-.008-.28-.024a1.45 1.45 0 0 1-.261-.072c-1.98-.708-3.552-1.954-4.715-3.738C5.581 14.882 5 12.95 5 10.872V6.637c0-.34.098-.648.295-.924a1.66 1.66 0 0 1 .764-.596l5.367-2.011C11.62 3.036 11.81 3 12 3c.19 0 .383.035.579.106l5.367 2.011c.31.122.563.32.76.596.196.276.294.584.294.924v4.235c0 2.079-.581 4.01-1.744 5.794-1.163 1.784-2.734 3.03-4.712 3.738A1.558 1.558 0 0 1 12 20.5Zm0-1.302c1.64-.527 2.993-1.569 4.06-3.127 1.068-1.558 1.602-3.289 1.602-5.193v-4.25a.3.3 0 0 0-.193-.276L12.1 4.355A.27.27 0 0 0 12 4.337a.27.27 0 0 0-.101.018L6.53 6.352a.3.3 0 0 0-.193.276v4.25c0 1.904.534 3.635 1.602 5.193 1.067 1.558 2.42 2.6 4.06 3.127Z'
3036
/>
3137
<Path
32-
fill={props.color || '#000'}
38+
fill={color}
3339
d='M11.339 13.422c.202-.062.423-.093.662-.093.23 0 .45.031.658.093.208.061.4.15.574.268.17.083.348.12.532.113a.683.683 0 0 0 .475-.211.607.607 0 0 0 .19-.464.507.507 0 0 0-.228-.415 3.693 3.693 0 0 0-2.206-.71c-.404-.001-.785.057-1.145.175-.36.117-.704.293-1.032.527a.509.509 0 0 0-.24.414.587.587 0 0 0 .194.469.68.68 0 0 0 .47.214c.183.008.36-.03.531-.116.174-.114.363-.202.565-.264ZM10.072 10.497a5.364 5.364 0 0 1 1.923-.336c.693 0 1.335.112 1.926.336.591.224 1.118.52 1.582.886.154.116.323.17.506.165a.671.671 0 0 0 .469-.204.587.587 0 0 0 .187-.467.597.597 0 0 0-.236-.441 7.195 7.195 0 0 0-2.032-1.177 6.697 6.697 0 0 0-2.4-.426c-.854 0-1.653.142-2.398.426a7.247 7.247 0 0 0-2.032 1.175.592.592 0 0 0-.037.912c.13.129.284.196.463.202a.776.776 0 0 0 .5-.165c.464-.366.99-.662 1.579-.886Z'
3440
/>
3541
</Svg>

0 commit comments

Comments
 (0)