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

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

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

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

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

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