@xetwa/design-system 1.0.22 → 1.0.23
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
|
@@ -16,8 +16,10 @@ export interface AnswerOptionCardProps {
|
|
|
16
16
|
status?: AnswerOptionStatus;
|
|
17
17
|
/** O texto principal da opção. */
|
|
18
18
|
label: string;
|
|
19
|
-
/** Nó renderizado à esquerda do texto (ex:
|
|
19
|
+
/** Nó renderizado à esquerda do texto (ex: ícones complexos). */
|
|
20
20
|
prefixNode?: ReactNode;
|
|
21
|
+
/** Letra ou número a exibir automaticamente do lado esquerdo. */
|
|
22
|
+
prefix?: string | number;
|
|
21
23
|
/** Nó renderizado à direita. Se omitido, renderiza automaticamente ícones de check/cross consoante o estado. */
|
|
22
24
|
suffixNode?: ReactNode;
|
|
23
25
|
/** Callback para o evento de clique. */
|
|
@@ -30,6 +32,7 @@ export const AnswerOptionCard = ({
|
|
|
30
32
|
status = 'default',
|
|
31
33
|
label,
|
|
32
34
|
prefixNode,
|
|
35
|
+
prefix,
|
|
33
36
|
suffixNode,
|
|
34
37
|
onPress,
|
|
35
38
|
style,
|
|
@@ -144,6 +147,17 @@ export const AnswerOptionCard = ({
|
|
|
144
147
|
<View style={styles.contentRow}>
|
|
145
148
|
<View style={styles.leftSection}>
|
|
146
149
|
{prefixNode && <View style={[styles.prefixContainer, { marginRight: scale(12) }]}>{prefixNode}</View>}
|
|
150
|
+
{prefix && !prefixNode && (
|
|
151
|
+
<View style={[styles.prefixContainer, { marginRight: scale(12) }]}>
|
|
152
|
+
<Typography style={{
|
|
153
|
+
color: status === 'selected' || status === 'correct' ? theme.colors.primary : theme.colors.brown[400],
|
|
154
|
+
fontWeight: 'bold',
|
|
155
|
+
fontSize: scaleText(16)
|
|
156
|
+
}}>
|
|
157
|
+
{prefix}
|
|
158
|
+
</Typography>
|
|
159
|
+
</View>
|
|
160
|
+
)}
|
|
147
161
|
<Typography
|
|
148
162
|
style={[
|
|
149
163
|
styles.label,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { theme } from '../../../styles/theme';
|
|
3
|
+
import { Typography } from '../../Typography/Typography';
|
|
4
|
+
|
|
5
|
+
export interface NumberBadgeProps {
|
|
6
|
+
value: string | number;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
correct?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const NumberBadge = ({ value, selected = false, correct = false }: NumberBadgeProps) => {
|
|
12
|
+
let bgColor = theme.colors.brown[100];
|
|
13
|
+
let textColor = theme.colors.brown[500];
|
|
14
|
+
|
|
15
|
+
if (selected) {
|
|
16
|
+
bgColor = theme.colors.primary;
|
|
17
|
+
textColor = theme.colors.white;
|
|
18
|
+
} else if (correct) {
|
|
19
|
+
bgColor = theme.colors.success;
|
|
20
|
+
textColor = theme.colors.white;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<View style={{
|
|
25
|
+
width: 28,
|
|
26
|
+
height: 28,
|
|
27
|
+
borderRadius: 14,
|
|
28
|
+
backgroundColor: bgColor,
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
}}>
|
|
32
|
+
<Typography style={{
|
|
33
|
+
fontSize: 14,
|
|
34
|
+
color: textColor,
|
|
35
|
+
}}>
|
|
36
|
+
{value}
|
|
37
|
+
</Typography>
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from './components/Cards/Passport/PassportViewer';
|
|
|
37
37
|
export * from './components/DataDisplay/Avatar/Avatar';
|
|
38
38
|
export * from './components/DataDisplay/InstructionBubble/InstructionBubble';
|
|
39
39
|
export * from './components/DataDisplay/StatBadge/StatBadge';
|
|
40
|
+
export * from './components/DataDisplay/NumberBadge/NumberBadge';
|
|
40
41
|
export * from './components/Forms/Checkbox/Checkbox';
|
|
41
42
|
export * from './components/Forms/DaySelector/DaySelector';
|
|
42
43
|
export * from './components/Forms/Radio/Radio';
|