@tactics/toddle-styleguide 1.7.13 → 1.7.15

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.13",
3
+ "version": "1.7.15",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  interface CountProps {
3
3
  count: number;
4
+ disabled?: boolean;
4
5
  }
5
- export declare const Count: ({ count, }: CountProps) => React.JSX.Element;
6
+ export declare const Count: ({ count, disabled }: CountProps) => React.JSX.Element;
6
7
  export {};
@@ -7,13 +7,15 @@ import { Paragraph } from "../paragraph-components";
7
7
 
8
8
  interface CountProps {
9
9
  count: number;
10
+ disabled?: boolean
10
11
  }
11
12
 
12
13
  export const Count = ({
13
14
  count,
15
+ disabled
14
16
  }: CountProps) => {
15
17
  const context = useContext(ThemeCtx);
16
- const styles = Stylesheet(context);
18
+ const styles = Stylesheet(context, disabled);
17
19
  return <View style={styles.container}>
18
20
  <Paragraph addStyle={styles.text}>{count}</Paragraph>
19
21
  </View>;
@@ -1,4 +1,4 @@
1
- export function Stylesheet(context: any): {
1
+ export function Stylesheet(context: any, disabled: any): {
2
2
  container: {
3
3
  borderWidth: number;
4
4
  borderColor: any;
@@ -16,5 +16,6 @@ export function Stylesheet(context: any): {
16
16
  text: {
17
17
  width: "auto";
18
18
  fontSize: number;
19
+ color: any;
19
20
  };
20
21
  };
@@ -1,24 +1,25 @@
1
1
  import {StyleSheet} from 'react-native';
2
2
  import { Scale } from '../../../theme/scale';
3
3
 
4
- export const Stylesheet = (context) =>
4
+ export const Stylesheet = (context, disabled) =>
5
5
  StyleSheet.create({
6
6
  container: {
7
7
  borderWidth: 1,
8
- borderColor: context.colors.main['1'],
8
+ borderColor: disabled === true ? context.colors.ui.xlightgrey : context.colors.main['1'],
9
9
  borderRadius: 20,
10
10
  paddingVertical: Scale.xs,
11
11
  paddingHorizontal: Scale.m,
12
12
  minWidth: Scale.xxxl,
13
- color: context.colors.main['2'],
13
+ color: disabled === true ? context.colors.ui.grey : context.colors.main['2'],
14
14
  display: 'flex',
15
15
  alignItems: 'center',
16
16
  justifyContent: 'center',
17
17
  flex: 0,
18
- backgroundColor: context.colors.ui.white
18
+ backgroundColor: disabled === true ? context.colors.ui.xlightgrey : context.colors.ui.white
19
19
  },
20
20
  text: {
21
21
  width: 'auto',
22
- fontSize: Scale.m
22
+ fontSize: Scale.m,
23
+ color: disabled === true ? context.colors.ui.grey : context.colors.main['2'],
23
24
  }
24
25
  });
@@ -6,6 +6,7 @@ interface AmountProps {
6
6
  label: string;
7
7
  description?: string;
8
8
  onSave: (num: number) => void;
9
+ readonly: boolean;
9
10
  }
10
- export declare const Amount: ({ initialAmount, image, label, description, onSave }: AmountProps) => React.JSX.Element;
11
+ export declare const Amount: ({ initialAmount, image, label, description, onSave, readonly }: AmountProps) => React.JSX.Element;
11
12
  export {};
@@ -14,7 +14,8 @@ interface AmountProps {
14
14
  image?: ImageSourcePropType;
15
15
  label: string;
16
16
  description?: string;
17
- onSave: (num: number) => void
17
+ onSave: (num: number) => void;
18
+ readonly: boolean
18
19
  }
19
20
 
20
21
  export const Amount = ({
@@ -22,7 +23,8 @@ export const Amount = ({
22
23
  image,
23
24
  label,
24
25
  description,
25
- onSave
26
+ onSave,
27
+ readonly
26
28
  }: AmountProps) => {
27
29
  const [editMode, setEditMode] = useState(false);
28
30
  const [countdown, setCountdown] = useState(0);
@@ -80,6 +82,32 @@ export const Amount = ({
80
82
  </>
81
83
  }
82
84
 
85
+ const renderInput = () => {
86
+ return <View style={styles.incrementContainer}>
87
+ {editMode ? (
88
+ <>
89
+ <View>
90
+ <IncrementInput value={amount} onPress={updateAmount} />
91
+ </View>
92
+ <PressableIcon
93
+ onPress={saveChargedProduct}
94
+ icon={
95
+ <Icon key={label} name="check-circle" style="regular" />
96
+ }
97
+ />
98
+ </>
99
+ ) : (
100
+ <Pressable onPress={startEditMode}>
101
+ <Count count={amount} />
102
+ </Pressable>
103
+ )}
104
+ </View>
105
+ }
106
+
107
+ const renderCount = () => {
108
+ return <Count disabled={true} count={amount} />
109
+ }
110
+
83
111
  return (
84
112
  <View style={styles.rootContainer}>
85
113
  <View style={styles.imageContainer}>
@@ -88,25 +116,7 @@ export const Amount = ({
88
116
  <View style={styles.container}>
89
117
  <Paragraph bold={true} numberOfLines={1} ellipsizeMode="tail">{label}</Paragraph>
90
118
  {description ? <Paragraph textColor={context.colors.ui.darkgrey} numberOfLines={1} ellipsizeMode="tail">{description}</Paragraph> : <></>}
91
- <View style={styles.incrementContainer}>
92
- {editMode ? (
93
- <>
94
- <View>
95
- <IncrementInput value={amount} onPress={updateAmount} />
96
- </View>
97
- <PressableIcon
98
- onPress={saveChargedProduct}
99
- icon={
100
- <Icon key={label} name="check-circle" style="regular" />
101
- }
102
- />
103
- </>
104
- ) : (
105
- <Pressable onPress={startEditMode}>
106
- <Count count={amount} />
107
- </Pressable>
108
- )}
109
- </View>
119
+ {readonly ? renderCount() : renderInput()}
110
120
  </View>
111
121
  </View>
112
122
  );
@@ -12,10 +12,14 @@ export const AmountPreview = ({}: {}) => {
12
12
  backgroundColor: 'white',
13
13
  }}
14
14
  >
15
- <Amount initialAmount={9} label='Maaltijd' onSave={(num) => console.log(num)} />
16
- <Amount initialAmount={2} image={require('./../../../../assets/components/avatar/baby.png')} label='Maaltijd' onSave={(num) => console.log(num)} />
17
- <Amount initialAmount={5} label='Maaltijd veggy' description='Hmm, lekker hoor' onSave={(num) => console.log(num)} />
18
- <Amount initialAmount={1} image={require('./../../../../assets/components/avatar/baby.png')} label='Maaltijd met een lekkere lange titel' description='Hmm, lekker hoor. Met een sappige beschrijving' onSave={(num) => console.log(num)} />
15
+ <Amount readonly={false} initialAmount={9} label='Maaltijd' onSave={(num) => console.log(num)} />
16
+ <Amount readonly={false} initialAmount={2} image={require('./../../../../assets/components/avatar/baby.png')} label='Maaltijd' onSave={(num) => console.log(num)} />
17
+ <Amount readonly={false} initialAmount={5} label='Maaltijd veggy' description='Hmm, lekker hoor' onSave={(num) => console.log(num)} />
18
+ <Amount readonly={false} initialAmount={1} image={require('./../../../../assets/components/avatar/baby.png')} label='Maaltijd met een lekkere lange titel' description='Hmm, lekker hoor. Met een sappige beschrijving' onSave={(num) => console.log(num)} />
19
+ <Amount readonly={true} initialAmount={9} label='Maaltijd' onSave={(num) => console.log(num)} />
20
+ <Amount readonly={true} initialAmount={2} image={require('./../../../../assets/components/avatar/baby.png')} label='Maaltijd' onSave={(num) => console.log(num)} />
21
+ <Amount readonly={true} initialAmount={5} label='Maaltijd veggy' description='Hmm, lekker hoor' onSave={(num) => console.log(num)} />
22
+ <Amount readonly={true} initialAmount={1} image={require('./../../../../assets/components/avatar/baby.png')} label='Maaltijd met een lekkere lange titel' description='Hmm, lekker hoor. Met een sappige beschrijving' onSave={(num) => console.log(num)} />
19
23
  </View>
20
24
  </ScrollView>
21
25
  );
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  type InfoProps = {
3
- label: string;
3
+ label?: string;
4
4
  description: string;
5
+ active?: boolean;
5
6
  };
6
- declare const Info: ({ label, description }: InfoProps) => React.JSX.Element;
7
+ declare const Info: ({ label, description, active }: InfoProps) => React.JSX.Element;
7
8
  export { Info as Info };
@@ -8,20 +8,21 @@ import {Heading3} from '../../atoms/heading-components';
8
8
  import {SmallText} from '../../atoms/paragraph-components';
9
9
 
10
10
  type InfoProps = {
11
- label: string;
11
+ label?: string;
12
12
  description: string;
13
+ active?: boolean
13
14
  };
14
15
 
15
- const Info = ({label, description}: InfoProps) => {
16
+ const Info = ({label, description, active}: InfoProps) => {
16
17
  const context = useContext(ThemeCtx);
17
18
  const styles = Stylesheet(context);
18
19
 
19
20
  return (
20
21
  <View style={styles.container}>
21
- <Heading3 bold={true} addStyle={styles.label}>
22
+ {label && <Heading3 bold={true} addStyle={styles.label}>
22
23
  {label}
23
- </Heading3>
24
- <SmallText textColor={context.colors.ui.darkgrey}>
24
+ </Heading3>}
25
+ <SmallText textColor={active !== undefined && active === false ? context.colors.ui.grey : context.colors.ui.darkgrey}>
25
26
  {description}
26
27
  </SmallText>
27
28
  </View>
@@ -10,12 +10,20 @@ export const InfoPreview = ({}: {}) => {
10
10
  alignItems: 'center',
11
11
  justifyContent: 'center',
12
12
  backgroundColor: 'white',
13
+ gap: 16,
13
14
  }}
14
15
  >
15
16
  <Info
16
17
  label={'Mijn Gezin'}
17
18
  description={'Volg hier de dag van uw kinderen'}
18
19
  />
20
+ <Info
21
+ description={'Luca was heel de dag wat flauw en voelde zich niet lekker. Mama is haar vroeger komen halen.'}
22
+ />
23
+ <Info
24
+ active={false}
25
+ description={'Geen opmerking voor deze dag.'}
26
+ />
19
27
  </View>
20
28
  );
21
29
  };