Skip to content

Commit 49e6c5c

Browse files
committed
Add text wrapping
1 parent 68a9e34 commit 49e6c5c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

peerprep-fe/src/app/(main)/components/filter/TopicsPopover.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,16 @@ export function TopicsPopover({
4848

4949
const handleTopicSelection = (selectedTopic: string) => {
5050
if (multiselect) {
51-
// Multiple selection mode
5251
const newSelectedTopics = selectedTopics.includes(selectedTopic)
5352
? selectedTopics.filter((t) => t !== selectedTopic)
5453
: [...selectedTopics, selectedTopic];
5554
onChange(newSelectedTopics);
5655
} else {
57-
// Single selection mode
5856
const newSelectedTopics = selectedTopics.includes(selectedTopic)
59-
? [] // Deselect if clicking the same topic
60-
: [selectedTopic]; // Select only the clicked topic
57+
? []
58+
: [selectedTopic];
6159
onChange(newSelectedTopics);
62-
setOpen(false); // Close popover after selection in single select mode
60+
setOpen(false);
6361
}
6462
};
6563

@@ -116,18 +114,18 @@ export function TopicsPopover({
116114
<Button
117115
key={topic}
118116
variant="ghost"
119-
className="justify-start"
117+
className="h-auto min-h-[2.5rem] justify-start whitespace-normal text-left"
120118
onClick={() => handleTopicSelection(topic)}
121119
>
122120
<Check
123121
className={cn(
124-
'mr-2 h-4 w-4',
122+
'mr-2 h-4 w-4 shrink-0',
125123
selectedTopics.includes(topic)
126124
? 'opacity-100'
127125
: 'opacity-0',
128126
)}
129127
/>
130-
{topic}
128+
<span className="break-words">{topic}</span>
131129
</Button>
132130
))}
133131
</div>

0 commit comments

Comments
 (0)