@tactics/toddle-styleguide 1.7.17 → 1.7.18

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": "@tactics/toddle-styleguide",
3
- "version": "1.7.17",
3
+ "version": "1.7.18",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -27,6 +27,14 @@ export const SelectListItemPreview = ({}: {}) => {
27
27
  inverse={true}
28
28
  onPress={() => console.log('clicked')}
29
29
  />
30
+ <SelectListItem
31
+ title="Vlindertjes"
32
+ subtitle={'Leeftijd 2 tot 4 jaar'}
33
+ icon={<Icon style={'regular'} name={'office-building'} size={27} />}
34
+ inverse={true}
35
+ onPress={() => console.log('clicked')}
36
+ image={require('./../../../../assets/components/avatar/baby.png')}
37
+ />
30
38
  </View>
31
39
  );
32
40
  };
@@ -1,10 +1,12 @@
1
1
  import * as React from 'react';
2
+ import { ImageSourcePropType } from 'react-native';
2
3
  type SelectListProps = {
3
4
  title: string;
4
5
  subtitle?: string;
5
6
  icon: React.ReactElement;
6
7
  onPress?: () => void;
7
8
  inverse?: boolean;
9
+ image?: ImageSourcePropType;
8
10
  };
9
- declare const SelectListItem: ({ title, subtitle, icon, onPress, inverse, }: SelectListProps) => React.JSX.Element;
11
+ declare const SelectListItem: ({ title, subtitle, icon, onPress, inverse, image }: SelectListProps) => React.JSX.Element;
10
12
  export { SelectListItem as SelectListItem };
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import {useContext} from 'react';
3
3
 
4
4
  import {ThemeCtx} from '../../../context/theme.context';
5
- import {Pressable, View} from 'react-native';
5
+ import {ImageSourcePropType, ImageStyle, Image, Pressable, View} from 'react-native';
6
6
  import {Stylesheet} from './select-list-item.styles';
7
7
  import {Icon} from '../../../icons/index';
8
8
  import {Heading2} from '../../atoms/heading-components';
@@ -14,6 +14,7 @@ type SelectListProps = {
14
14
  icon: React.ReactElement;
15
15
  onPress?: () => void;
16
16
  inverse?: boolean;
17
+ image?: ImageSourcePropType
17
18
  };
18
19
 
19
20
  const SelectListItem = ({
@@ -22,6 +23,7 @@ const SelectListItem = ({
22
23
  icon,
23
24
  onPress,
24
25
  inverse,
26
+ image
25
27
  }: SelectListProps) => {
26
28
  const context = useContext(ThemeCtx);
27
29
  const styles = Stylesheet(context, inverse);
@@ -32,10 +34,18 @@ const SelectListItem = ({
32
34
  })
33
35
  );
34
36
 
37
+ const renderIconOrImage = () => {
38
+ if (image) {
39
+ return <Image source={image} style={styles.image as ImageStyle} />
40
+ } else {
41
+ return <View>{inverse ? invertedIcon : icon}</View>
42
+ }
43
+ }
44
+
35
45
  return (
36
46
  <Pressable onPress={onPress} style={styles.container}>
37
47
  <View style={styles.iconCircle}>
38
- <View>{inverse ? invertedIcon : icon}</View>
48
+ {renderIconOrImage()}
39
49
  </View>
40
50
  <View style={styles.textContainer}>
41
51
  <View>
@@ -1,4 +1,4 @@
1
- export function Stylesheet(context: any, inverse: any): {
1
+ export function Stylesheet(context: any, inverse: any): StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
2
2
  container: {
3
3
  width: "100%";
4
4
  flexDirection: "row";
@@ -13,6 +13,12 @@ export function Stylesheet(context: any, inverse: any): {
13
13
  borderRadius: number;
14
14
  marginRight: number;
15
15
  };
16
+ image: {
17
+ position: string;
18
+ width: string;
19
+ height: string;
20
+ borderRadius: number;
21
+ }[];
16
22
  textContainer: {
17
23
  flex: number;
18
24
  flexDirection: "column";
@@ -26,4 +32,5 @@ export function Stylesheet(context: any, inverse: any): {
26
32
  marginLeft: number;
27
33
  marginRight: number;
28
34
  };
29
- };
35
+ }>;
36
+ import { StyleSheet } from 'react-native';
@@ -19,6 +19,14 @@ export const Stylesheet = (context, inverse) =>
19
19
  borderRadius: 62 / 2,
20
20
  marginRight: Scale.m,
21
21
  },
22
+ image: [
23
+ {
24
+ position: 'absolute',
25
+ width: '90%',
26
+ height: '90%',
27
+ borderRadius: 50,
28
+ },
29
+ ],
22
30
  textContainer: {
23
31
  flex: 1,
24
32
  flexDirection: 'column',