@tactics/toddle-styleguide 4.0.0 → 4.0.2

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": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  type ContactRoleProps = {
3
3
  name: string;
4
4
  role?: string;
5
+ tags?: string[];
5
6
  };
6
- export declare const ContactRole: ({ name, role }: ContactRoleProps) => React.JSX.Element;
7
+ export declare const ContactRole: ({ name, role, tags }: ContactRoleProps) => React.JSX.Element;
7
8
  export {};
@@ -3,21 +3,35 @@ import {View} from 'react-native';
3
3
  import {Stylesheet} from './contact-role.styles';
4
4
  import {Heading2} from '../../atoms/heading-components';
5
5
  import {SmallText} from '../../atoms/paragraph-components';
6
+ import { VisualState } from '../../../types/visual-state.enum';
7
+ import { Pill } from '../pill/pill.component';
6
8
 
7
9
  type ContactRoleProps = {
8
10
  name: string;
9
11
  role?: string;
12
+ tags?: string[];
10
13
  };
11
14
 
12
- export const ContactRole = ({name, role}: ContactRoleProps) => {
15
+ export const ContactRole = ({name, role, tags}: ContactRoleProps) => {
13
16
  const styles = Stylesheet();
14
17
 
18
+ const renderTags = (tags: string[]) => {
19
+ return tags.map((tag, index) => {
20
+ return <Pill key={index} label={tag} visualState={VisualState.INACTIVE} />;
21
+ });
22
+ }
23
+
15
24
  return (
16
25
  <View style={styles.container}>
17
26
  <Heading2 bold={true} textAlign={'center'} addStyle={styles.name}>
18
27
  {name}
19
28
  </Heading2>
20
29
  <SmallText textAlign={'center'}>{role}</SmallText>
30
+ {tags && tags.length > 0 && (
31
+ <View style={styles.tagsContainer}>
32
+ {renderTags(tags)}
33
+ </View>
34
+ )}
21
35
  </View>
22
36
  );
23
37
  };
@@ -11,7 +11,7 @@ export const ContactRolePreview = ({}: {}) => {
11
11
  justifyContent: 'center',
12
12
  }}
13
13
  >
14
- <ContactRole name={'Pieter Jannsens'} role={'Vader'} />
14
+ <ContactRole name={'Pieter Jannsens'} role={'Vader'} tags={['Afhaalcontact', 'Noodcontact']} />
15
15
  </View>
16
16
  );
17
17
  };
@@ -1,9 +1,16 @@
1
1
  export function Stylesheet(): {
2
- container: {
3
- display: 'flex';
4
- alignItems: 'center';
5
- };
6
- name: {
7
- marginBottom: number;
8
- };
2
+ container: {
3
+ display: "flex";
4
+ alignItems: "center";
5
+ };
6
+ name: {
7
+ marginBottom: number;
8
+ };
9
+ tagsContainer: {
10
+ display: "flex";
11
+ flexDirection: "row";
12
+ flexWrap: "wrap";
13
+ gap: number;
14
+ marginTop: number;
15
+ };
9
16
  };
@@ -10,4 +10,11 @@ export const Stylesheet = () =>
10
10
  name: {
11
11
  marginBottom: Scale.xxs,
12
12
  },
13
+ tagsContainer: {
14
+ display: 'flex',
15
+ flexDirection: 'row',
16
+ flexWrap: 'wrap',
17
+ gap: Scale.xs,
18
+ marginTop: Scale.xxs,
19
+ },
13
20
  });
@@ -4,6 +4,7 @@ type ContactItemProps = {
4
4
  label: string;
5
5
  onPress?: () => void;
6
6
  isBlocked?: boolean;
7
+ tags?: string[];
7
8
  };
8
- declare const ContactItem: ({ name, label, onPress, isBlocked }: ContactItemProps) => React.JSX.Element;
9
+ declare const ContactItem: ({ name, label, onPress, isBlocked, tags }: ContactItemProps) => React.JSX.Element;
9
10
  export { ContactItem as ContactItem };
@@ -17,9 +17,10 @@ type ContactItemProps = {
17
17
  label: string;
18
18
  onPress?: () => void;
19
19
  isBlocked?: boolean;
20
+ tags?: string[];
20
21
  };
21
22
 
22
- const ContactItem = ({name, label, onPress, isBlocked}: ContactItemProps) => {
23
+ const ContactItem = ({name, label, onPress, isBlocked, tags}: ContactItemProps) => {
23
24
  const context = useContext(ThemeCtx);
24
25
  const styles = Stylesheet(isBlocked);
25
26
 
@@ -32,6 +33,12 @@ const ContactItem = ({name, label, onPress, isBlocked}: ContactItemProps) => {
32
33
  setLastName(name.slice(name.lastIndexOf(' ') + 1));
33
34
  }, [name]);
34
35
 
36
+ const renderTags = (tags: string[]) => {
37
+ return tags.map((tag, index) => {
38
+ return <Pill key={index} label={tag} visualState={VisualState.INACTIVE} />;
39
+ });
40
+ }
41
+
35
42
  return (
36
43
  <Pressable onPress={onPress}>
37
44
  <View style={styles.container}>
@@ -66,6 +73,11 @@ const ContactItem = ({name, label, onPress, isBlocked}: ContactItemProps) => {
66
73
  </View>
67
74
  )}
68
75
  </View>
76
+ {tags && tags.length > 0 && !isBlocked && (
77
+ <View style={styles.tagsContainer}>
78
+ {renderTags(tags)}
79
+ </View>
80
+ )}
69
81
  </Pressable>
70
82
  );
71
83
  };
@@ -16,12 +16,14 @@ export const ContactItemPreview = ({}: {}) => {
16
16
  name={'John'}
17
17
  label={'Ouder 1'}
18
18
  onPress={() => console.log('clicked')}
19
+ tags={['Afhaalcontact', 'Noodcontact']}
19
20
  />
20
21
  <ContactItem
21
22
  name={'John Serve'}
22
23
  label={'Ouder 1'}
23
24
  onPress={() => console.log('clicked')}
24
25
  isBlocked={true}
26
+ tags={['Afhaalcontact', 'Noodcontact']}
25
27
  />
26
28
  <ContactItem
27
29
  name={
@@ -1,15 +1,22 @@
1
1
  export function Stylesheet(isBlocked: any): {
2
- container: {
3
- width: '100%';
4
- flexDirection: 'row';
5
- alignItems: 'center';
6
- };
7
- textContainer: {
8
- flex: number;
9
- marginLeft: number;
10
- marginRight: number;
11
- };
12
- iconSquare: {
13
- marginLeft: number;
14
- };
2
+ container: {
3
+ width: "100%";
4
+ flexDirection: "row";
5
+ alignItems: "center";
6
+ };
7
+ textContainer: {
8
+ flex: number;
9
+ marginLeft: number;
10
+ marginRight: number;
11
+ };
12
+ iconSquare: {
13
+ marginLeft: number;
14
+ };
15
+ tagsContainer: {
16
+ flexDirection: "row";
17
+ flexWrap: "wrap";
18
+ marginTop: number;
19
+ gap: number;
20
+ marginLeft: number;
21
+ };
15
22
  };
@@ -17,4 +17,11 @@ export const Stylesheet = (isBlocked) =>
17
17
  iconSquare: {
18
18
  marginLeft: Scale.xs,
19
19
  },
20
+ tagsContainer: {
21
+ flexDirection: 'row',
22
+ flexWrap: 'wrap',
23
+ marginTop: Scale.xxs,
24
+ gap: Scale.xs,
25
+ marginLeft: Scale.xxl,
26
+ }
20
27
  });
@@ -9,6 +9,7 @@ interface IContactInfoCard {
9
9
  isActive?: boolean;
10
10
  style?: ViewStyle;
11
11
  isLoading?: boolean;
12
+ tags?: string[];
12
13
  }
13
- export declare const PersonInfoCard: ({ source, isBlocked, isActive, name, label, style, isLoading, }: IContactInfoCard) => React.JSX.Element;
14
+ export declare const PersonInfoCard: ({ source, isBlocked, isActive, name, label, style, isLoading, tags }: IContactInfoCard) => React.JSX.Element;
14
15
  export {};
@@ -14,6 +14,7 @@ interface IContactInfoCard {
14
14
  isActive?: boolean;
15
15
  style?: ViewStyle;
16
16
  isLoading?: boolean;
17
+ tags?: string[];
17
18
  }
18
19
 
19
20
  export const PersonInfoCard = ({
@@ -24,6 +25,7 @@ export const PersonInfoCard = ({
24
25
  label,
25
26
  style,
26
27
  isLoading,
28
+ tags
27
29
  }: IContactInfoCard) => {
28
30
  const styles = Stylesheet();
29
31
  return (
@@ -37,7 +39,7 @@ export const PersonInfoCard = ({
37
39
  isLoading={isLoading}
38
40
  />
39
41
  </View>
40
- <ContactRole name={name} role={label} />
42
+ <ContactRole name={name} role={label} tags={tags} />
41
43
  </View>
42
44
  );
43
45
  };
@@ -1,6 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="node" />
3
- /// <reference types="react-native" />
4
2
  interface ThemeInterface {
5
3
  colors: {
6
4
  gradient: {