Skip to content

Commit 482965f

Browse files
committed
undo duplicate code
1 parent 221b062 commit 482965f

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/components/Calendar.tsx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ export function Calendar(props: {
2424
const { selectedActivities, viewedActivity, state } = props;
2525

2626
const renderEvent = ({ event }: EventContentArg) => {
27+
const TitleText = () => (
28+
<Text
29+
fontSize="sm"
30+
fontWeight="medium"
31+
overflow="hidden"
32+
textOverflow="clip"
33+
whiteSpace="nowrap"
34+
>
35+
{event.title}
36+
</Text>
37+
);
38+
2739
return (
2840
<Box
2941
color={event.textColor}
@@ -37,27 +49,10 @@ export function Calendar(props: {
3749
content={event.extendedProps.activity.name}
3850
portalled
3951
positioning={{ placement: "top" }}
40-
>
41-
<Text
42-
fontSize="sm"
43-
fontWeight="medium"
44-
overflow="hidden"
45-
textOverflow="clip"
46-
whiteSpace="nowrap"
47-
>
48-
{event.title}
49-
</Text>
50-
</Tooltip>
52+
children={TitleText()}
53+
/>
5154
) : (
52-
<Text
53-
fontSize="sm"
54-
fontWeight="medium"
55-
overflow="hidden"
56-
textOverflow="clip"
57-
whiteSpace="nowrap"
58-
>
59-
{event.title}
60-
</Text>
55+
<TitleText />
6156
)}
6257
<Text fontSize="xs">{event.extendedProps.room}</Text>
6358
</Box>

0 commit comments

Comments
 (0)