@homefile/components-v2 2.8.43 → 2.8.44
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.
|
@@ -4,11 +4,9 @@ import { Divider, Flex, Image, Show, Text } from '@chakra-ui/react';
|
|
|
4
4
|
import { IconMenu, MoreHorizontal } from '..';
|
|
5
5
|
import { Group } from '../../assets/images';
|
|
6
6
|
import { GroupIcons } from '../../helpers';
|
|
7
|
-
import {
|
|
7
|
+
import { getIconAltText } from '../../utils';
|
|
8
8
|
export const GroupCardHeader = ({ title, totalAmount, menuItems, }) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
return (_jsxs(Flex, { justifyContent: "space-between", bg: "neutral.white", align: "center", children: [_jsxs(Flex, { gap: "base", id: "organizeByGroup", bg: "neutral.white", p: "4", children: [_jsx(Image, { src: GroupIcons[title] || Group, alt: iconAlt, w: "1rem", h: "auto" }), _jsx(Text, { noOfLines: 1, children: title })] }), _jsxs(Flex, { align: "center", gap: "base", p: "4", id: "trackGroupValue", bg: "neutral.white", children: [_jsx(Show, { breakpoint: "(min-width: 600px)", children: _jsx(Text, { textColor: "gray.4", fontWeight: "semibold", fontSize: "xs", mr: "3", children: t('groups.total') }) }), _jsx(Text, { textColor: "blue.8", fontWeight: "semibold", fontSize: ['md', 'lg'], children: totalAmount }), menuItems && menuItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Show, { breakpoint: "(min-width: 600px)", children: _jsx(Divider, { orientation: "vertical", h: "6" }) }), _jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 38 }), menuItems: menuItems, disabled: haveNoMenuItems })] }))] })] }));
|
|
9
|
+
const iconAlt = getIconAltText(GroupIcons[title]);
|
|
10
|
+
const hasMenuItems = Number(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) > 0;
|
|
11
|
+
return (_jsxs(Flex, { justifyContent: "space-between", bg: "neutral.white", align: "center", children: [_jsxs(Flex, { gap: "base", id: "organizeByGroup", bg: "neutral.white", p: "4", children: [_jsx(Image, { src: GroupIcons[title] || Group, alt: iconAlt, w: "1rem", h: "auto" }), _jsx(Text, { noOfLines: 1, children: title })] }), _jsxs(Flex, { align: "center", gap: "base", p: "4", id: "trackGroupValue", bg: "neutral.white", children: [_jsx(Show, { breakpoint: "(min-width: 600px)", children: _jsx(Text, { textColor: "gray.4", fontWeight: "semibold", fontSize: "xs", mr: "3", children: t('groups.total') }) }), _jsx(Text, { textColor: "blue.8", fontWeight: "semibold", fontSize: ['md', 'lg'], children: totalAmount }), hasMenuItems && (_jsxs(_Fragment, { children: [_jsx(Show, { breakpoint: "(min-width: 600px)", children: _jsx(Divider, { orientation: "vertical", h: "6" }) }), _jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 38 }), menuItems: menuItems, disabled: !hasMenuItems })] }))] })] }));
|
|
14
12
|
};
|
package/package.json
CHANGED
|
@@ -4,17 +4,15 @@ import { IconMenu, MoreHorizontal } from '@/components'
|
|
|
4
4
|
import { GroupCardHeaderI } from '@/interfaces'
|
|
5
5
|
import { Group } from '@/assets/images'
|
|
6
6
|
import { GroupIcons } from '@/helpers'
|
|
7
|
-
import {
|
|
7
|
+
import { getIconAltText } from '@/utils'
|
|
8
8
|
|
|
9
9
|
export const GroupCardHeader = ({
|
|
10
10
|
title,
|
|
11
11
|
totalAmount,
|
|
12
12
|
menuItems,
|
|
13
13
|
}: GroupCardHeaderI) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
title,
|
|
17
|
-
})
|
|
14
|
+
const iconAlt = getIconAltText(GroupIcons[title])
|
|
15
|
+
const hasMenuItems = Number(menuItems?.length) > 0
|
|
18
16
|
|
|
19
17
|
return (
|
|
20
18
|
<Flex justifyContent="space-between" bg="neutral.white" align="center">
|
|
@@ -42,7 +40,7 @@ export const GroupCardHeader = ({
|
|
|
42
40
|
<Text textColor="blue.8" fontWeight="semibold" fontSize={['md', 'lg']}>
|
|
43
41
|
{totalAmount}
|
|
44
42
|
</Text>
|
|
45
|
-
{
|
|
43
|
+
{hasMenuItems && (
|
|
46
44
|
<>
|
|
47
45
|
<Show breakpoint="(min-width: 600px)">
|
|
48
46
|
<Divider orientation="vertical" h="6" />
|
|
@@ -50,7 +48,7 @@ export const GroupCardHeader = ({
|
|
|
50
48
|
<IconMenu
|
|
51
49
|
icon={<MoreHorizontal size={38} />}
|
|
52
50
|
menuItems={menuItems}
|
|
53
|
-
disabled={
|
|
51
|
+
disabled={!hasMenuItems}
|
|
54
52
|
/>
|
|
55
53
|
</>
|
|
56
54
|
)}
|