eletrotupi / tcc/ frontend/components/ui/MoodComponentCard.tsx6c571a3ed690948ef2705dc730c097b3a0c09ada
1.8 KB | 76 lines Raw
1
import React from 'react';
2
import { View, StyleSheet, ViewStyle } from 'react-native';
3
import { Text } from '@/components/ui/Text';
4
import { Row } from '@/components/ui/LayoutHelpers';
5
import { Card } from '@/components/ui/Cards';
6
import { getMoodComponent, intensityLabel } from '@/constants/mood-components';
7
import { Theme } from '@/constants/theme';
8

9
interface MoodComponentCardProps {
10
  id: string;
11
  intensity: number | string;
12
  style?: ViewStyle;
13
}
14

15
export const MoodComponentCard: React.FC<MoodComponentCardProps> = ({
16
  id,
17
  intensity,
18
  style,
19
}) => {
20
  const definition = getMoodComponent(id);
21
  if (!definition) return null;
22

23
  return (
24
    <Card style={[styles.card, style]}>
25
      <Row gap={6} style={styles.inner}>
26
        <View style={styles.mood}>
27
          <View style={[styles.dot, { backgroundColor: definition.color }]} />
28
          <Text style={styles.label} numberOfLines={1}>
29
            {definition.label}
30
          </Text>
31
        </View>
32

33
        <Text style={styles.intensity} numberOfLines={1}>
34
          {intensityLabel(intensity)}
35
        </Text>
36
      </Row>
37
    </Card>
38
  );
39
};
40

41
const styles = StyleSheet.create({
42
  card: {
43
    paddingHorizontal: 10,
44
    paddingVertical: 8,
45
  },
46
  mood: {
47
    flex: 1,
48
    flexDirection: 'row',
49
    alignItems: 'center',
50
    height: '100%',
51
  },
52
  inner: {
53
    alignItems: 'baseline',
54
    flexShrink: 1,
55
  },
56
  dot: {
57
    width: 8,
58
    height: 8,
59
    borderRadius: 5,
60
    flexShrink: 0,
61
    marginRight: 4,
62
    justifyContent: 'center'
63
  },
64
  label: {
65
    fontSize: Theme.typography.bodyMd.fontSize,
66
    fontWeight: '600',
67
    color: Theme.colors.light.text,
68
    flexShrink: 1,
69
  },
70
  intensity: {
71
    fontSize: Theme.typography.labelSm.fontSize,
72
    color: Theme.colors.light.moodIntensityLabel,
73
    flexShrink: 1,
74
    height: '100%',
75
  },
76
});