@tactics/toddle-styleguide 1.2.5 → 1.2.6

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.2.5",
3
+ "version": "1.2.6",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -1804,7 +1804,7 @@ exports[`Test for the calendar component renders a calendar where you can select
1804
1804
  }
1805
1805
  >
1806
1806
  <View
1807
- accessibilityLabel="today Woensdag 12 Juli 2023 "
1807
+ accessibilityLabel=" Woensdag 12 Juli 2023 "
1808
1808
  accessibilityRole="button"
1809
1809
  accessibilityState={
1810
1810
  {
@@ -1836,10 +1836,6 @@ exports[`Test for the calendar component renders a calendar where you can select
1836
1836
  style={
1837
1837
  {
1838
1838
  "alignItems": "center",
1839
- "borderColor": "#7B93DB",
1840
- "borderRadius": 21,
1841
- "borderStyle": "solid",
1842
- "borderWidth": 1,
1843
1839
  "height": 42,
1844
1840
  "justifyContent": "center",
1845
1841
  "opacity": 1,
@@ -1859,9 +1855,6 @@ exports[`Test for the calendar component renders a calendar where you can select
1859
1855
  "lineHeight": 22.4,
1860
1856
  "marginTop": 4,
1861
1857
  },
1862
- {
1863
- "color": "#7B93DB",
1864
- },
1865
1858
  ]
1866
1859
  }
1867
1860
  >
@@ -1892,7 +1885,7 @@ exports[`Test for the calendar component renders a calendar where you can select
1892
1885
  }
1893
1886
  >
1894
1887
  <View
1895
- accessibilityLabel=" Donderdag 13 Juli 2023 "
1888
+ accessibilityLabel="today Donderdag 13 Juli 2023 "
1896
1889
  accessibilityRole="button"
1897
1890
  accessibilityState={
1898
1891
  {
@@ -1924,6 +1917,10 @@ exports[`Test for the calendar component renders a calendar where you can select
1924
1917
  style={
1925
1918
  {
1926
1919
  "alignItems": "center",
1920
+ "borderColor": "#7B93DB",
1921
+ "borderRadius": 21,
1922
+ "borderStyle": "solid",
1923
+ "borderWidth": 1,
1927
1924
  "height": 42,
1928
1925
  "justifyContent": "center",
1929
1926
  "opacity": 1,
@@ -1943,6 +1940,9 @@ exports[`Test for the calendar component renders a calendar where you can select
1943
1940
  "lineHeight": 22.4,
1944
1941
  "marginTop": 4,
1945
1942
  },
1943
+ {
1944
+ "color": "#7B93DB",
1945
+ },
1946
1946
  ]
1947
1947
  }
1948
1948
  >
@@ -5782,8 +5782,7 @@ exports[`Test for the calendar component renders a calendar where you can select
5782
5782
  }
5783
5783
  >
5784
5784
  <View
5785
- accessibilityLabel="today Woensdag 12 Juli 2023 "
5786
- accessibilityRole="button"
5785
+ accessibilityLabel=" Woensdag 12 Juli 2023 "
5787
5786
  accessibilityState={
5788
5787
  {
5789
5788
  "busy": undefined,
@@ -5814,10 +5813,6 @@ exports[`Test for the calendar component renders a calendar where you can select
5814
5813
  style={
5815
5814
  {
5816
5815
  "alignItems": "center",
5817
- "borderColor": "#7B93DB",
5818
- "borderRadius": 21,
5819
- "borderStyle": "solid",
5820
- "borderWidth": 1,
5821
5816
  "height": 42,
5822
5817
  "justifyContent": "center",
5823
5818
  "opacity": 1,
@@ -5838,7 +5833,7 @@ exports[`Test for the calendar component renders a calendar where you can select
5838
5833
  "marginTop": 4,
5839
5834
  },
5840
5835
  {
5841
- "color": "#7B93DB",
5836
+ "color": "#9AA5B1",
5842
5837
  },
5843
5838
  ]
5844
5839
  }
@@ -5870,7 +5865,8 @@ exports[`Test for the calendar component renders a calendar where you can select
5870
5865
  }
5871
5866
  >
5872
5867
  <View
5873
- accessibilityLabel=" Donderdag 13 Juli 2023 "
5868
+ accessibilityLabel="today Donderdag 13 Juli 2023 "
5869
+ accessibilityRole="button"
5874
5870
  accessibilityState={
5875
5871
  {
5876
5872
  "busy": undefined,
@@ -5901,6 +5897,10 @@ exports[`Test for the calendar component renders a calendar where you can select
5901
5897
  style={
5902
5898
  {
5903
5899
  "alignItems": "center",
5900
+ "borderColor": "#7B93DB",
5901
+ "borderRadius": 21,
5902
+ "borderStyle": "solid",
5903
+ "borderWidth": 1,
5904
5904
  "height": 42,
5905
5905
  "justifyContent": "center",
5906
5906
  "opacity": 1,
@@ -5921,7 +5921,7 @@ exports[`Test for the calendar component renders a calendar where you can select
5921
5921
  "marginTop": 4,
5922
5922
  },
5923
5923
  {
5924
- "color": "#9AA5B1",
5924
+ "color": "#7B93DB",
5925
5925
  },
5926
5926
  ]
5927
5927
  }
@@ -36,7 +36,7 @@ exports[`test Tag renders Tag correctly (blue, bold grey text) when isSelected i
36
36
  style={
37
37
  {
38
38
  "alignItems": "center",
39
- "backgroundColor": "#E5E8EB",
39
+ "backgroundColor": "#647ACB",
40
40
  "borderRadius": 50,
41
41
  "justifyContent": "center",
42
42
  "paddingBottom": 8,
@@ -51,13 +51,13 @@ exports[`test Tag renders Tag correctly (blue, bold grey text) when isSelected i
51
51
  [
52
52
  [
53
53
  {
54
- "fontFamily": "Montserrat",
54
+ "fontFamily": "MontserratBold",
55
55
  "fontSize": 13,
56
56
  "lineHeight": 20.4,
57
57
  },
58
58
  ],
59
59
  {
60
- "color": "#1F2933",
60
+ "color": "#E0E8F9",
61
61
  "textAlign": "center",
62
62
  "width": "100%",
63
63
  },
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {useContext, useState} from 'react';
2
+ import {useContext} from 'react';
3
3
 
4
4
  import {ThemeCtx} from '../../../context/theme.context';
5
5
  import {Stylesheet} from './tag.styles';
@@ -9,33 +9,28 @@ import {SmallText} from '../../atoms/paragraph-components';
9
9
  type TagProps = {
10
10
  value: string;
11
11
  label: string;
12
- onPress: (event: string) => void;
12
+ onPress: (value: string, isSelected: boolean) => void;
13
+ isSelected: boolean;
13
14
  };
14
15
 
15
- const Tag = ({label, onPress, value}: TagProps) => {
16
- const [isSelectedTag, setIsSelectedTag] = useState(false);
16
+ const Tag = ({label, onPress, value, isSelected}: TagProps) => {
17
17
  const context = useContext(ThemeCtx);
18
- const styles = Stylesheet(context, isSelectedTag);
18
+ const styles = Stylesheet(context, isSelected);
19
19
 
20
20
  const onClicked = () => {
21
- setIsSelectedTag((current) => !current);
22
- onPress(value);
21
+ onPress(value, !isSelected);
23
22
  };
24
23
 
25
24
  return (
26
25
  <Pressable onPress={onClicked}>
27
26
  <View style={styles.container}>
28
- {isSelectedTag ? (
29
- <SmallText
30
- bold={true}
31
- textAlign={'center'}
32
- textColor={context.colors.main[9]}
33
- >
34
- {label}
35
- </SmallText>
36
- ) : (
37
- <SmallText textAlign={'center'}>{label}</SmallText>
38
- )}
27
+ <SmallText
28
+ bold={isSelected}
29
+ textAlign={'center'}
30
+ textColor={isSelected ? context.colors.main[9] : undefined}
31
+ >
32
+ {label}
33
+ </SmallText>
39
34
  </View>
40
35
  </Pressable>
41
36
  );
@@ -1,11 +1,23 @@
1
1
  import React, {useState} from 'react';
2
2
  import {Tag} from './tag.component';
3
- import {View} from 'react-native';
3
+ import {View, Text} from 'react-native';
4
4
 
5
5
  export const TagPreview = ({}: {}) => {
6
- const [value, setValue] = useState('');
6
+ const [singleTag, setSingleTag] = useState('');
7
+ const [selectedTags, setSelectedTags] = useState<string[]>([]);
8
+
9
+ const handleSingleTagPress = (value: string) => {
10
+ setSingleTag(value);
11
+ };
12
+
13
+ const handleTagPress = (value: string, isSelected: boolean) => {
14
+ if (isSelected) {
15
+ setSelectedTags([...selectedTags, value]);
16
+ } else {
17
+ setSelectedTags(selectedTags.filter((tag) => tag !== value));
18
+ }
19
+ };
7
20
 
8
- console.log(value);
9
21
  return (
10
22
  <View
11
23
  style={{
@@ -16,15 +28,58 @@ export const TagPreview = ({}: {}) => {
16
28
  gap: 12,
17
29
  }}
18
30
  >
31
+ <Text>Select single tag</Text>
32
+ <View>
33
+ <Tag
34
+ value={'Option 1'}
35
+ label={'Option 1'}
36
+ onPress={handleSingleTagPress}
37
+ isSelected={singleTag === 'Option 1'}
38
+ />
39
+ </View>
40
+ <View>
41
+ <Tag
42
+ value={'Option 2'}
43
+ label={'Option 2'}
44
+ onPress={handleSingleTagPress}
45
+ isSelected={singleTag === 'Option 2'}
46
+ />
47
+ </View>
48
+ <View>
49
+ <Tag
50
+ value={'Option 3'}
51
+ label={'Option 3'}
52
+ onPress={handleSingleTagPress}
53
+ isSelected={singleTag === 'Option 3'}
54
+ />
55
+ </View>
56
+ <Text style={{marginBottom: 16}}>Selected tag: {singleTag}</Text>
57
+ <Text>Select multiple tags</Text>
19
58
  <View>
20
- <Tag value={'tab1'} label={'Algemeen'} onPress={setValue} />
59
+ <Tag
60
+ value={'Algemeen'}
61
+ label={'Algemeen'}
62
+ onPress={handleTagPress}
63
+ isSelected={selectedTags.includes('Algemeen')}
64
+ />
21
65
  </View>
22
66
  <View>
23
- <Tag value={'tab2'} label={'Gezondheid'} onPress={setValue} />
67
+ <Tag
68
+ value={'Gezondheid'}
69
+ label={'Gezondheid'}
70
+ onPress={handleTagPress}
71
+ isSelected={selectedTags.includes('Gezondheid')}
72
+ />
24
73
  </View>
25
74
  <View>
26
- <Tag value={'tab3'} label={'Activiteit'} onPress={setValue} />
75
+ <Tag
76
+ value={'Activiteit'}
77
+ label={'Activiteit'}
78
+ onPress={handleTagPress}
79
+ isSelected={selectedTags.includes('Activiteit')}
80
+ />
27
81
  </View>
82
+ <Text>Selected tags: {selectedTags.join(', ')}</Text>
28
83
  </View>
29
84
  );
30
85
  };
@@ -10,6 +10,7 @@ describe('test Tag', () => {
10
10
  value={'Geblokkeerd'}
11
11
  text={'Geblokkeerd'}
12
12
  onPress={(value) => console.log(value)}
13
+ isSelected={false}
13
14
  />
14
15
  )
15
16
  .toJSON();
@@ -23,6 +24,7 @@ describe('test Tag', () => {
23
24
  value={'Test2'}
24
25
  text={'Tag2'}
25
26
  onPress={(value) => console.log(value)}
27
+ isSelected={true}
26
28
  />
27
29
  )
28
30
  .toJSON();