Skip to content

Commit 5855823

Browse files
authored
fix(website): Fix text wrapping on group page on mobile (#6388)
I noticed some issues with the text wrapping on the Groups page on mobile screen width - this PR prevents text wrapping on the label for group details and on the count for group sequences. ### Screenshot Before: <img width="485" height="1126" alt="image" src="https://github.com/user-attachments/assets/546d4ddb-edda-4ce3-9a20-1bfb3f16361b" /> After: <img width="485" height="1108" alt="image" src="https://github.com/user-attachments/assets/7693d68e-dba8-4299-85b7-a3673727b174" /> ### PR Checklist - [ ] All necessary documentation has been adapted. - [ ] The implemented feature is covered by appropriate, automated tests. - [ ] Any manual testing that has been done is documented (i.e. what exactly was tested?) 🚀 Preview: Add `preview` label to enable
1 parent 636c732 commit 5855823

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

website/src/components/User/GroupPage.tsx

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,21 @@ const InnerGroupPage: FC<GroupPageProps> = ({
179179
</h1>
180180
)}
181181

182-
<div className=' max-w-2xl mx-auto px-10 py-4 bg-gray-100 rounded-md my-4'>
182+
<div className='max-w-2xl mx-auto px-10 py-4 bg-gray-100 rounded-md my-4'>
183183
<table className='w-full'>
184184
<tbody>
185-
<TableRow label='Group ID'>{groupDetails.data?.group.groupId}</TableRow>
186-
<TableRow label='Institution'>{groupDetails.data?.group.institution}</TableRow>
185+
<TableRow label='Group ID' noWrapLabel>
186+
{groupDetails.data?.group.groupId}
187+
</TableRow>
188+
<TableRow label='Institution' noWrapLabel>
189+
{groupDetails.data?.group.institution}
190+
</TableRow>
187191
{accessToken && (
188-
<TableRow label='Contact email'>{groupDetails.data?.group.contactEmail}</TableRow>
192+
<TableRow label='Contact email' noWrapLabel>
193+
{groupDetails.data?.group.contactEmail}
194+
</TableRow>
189195
)}
190-
<TableRow label='Address'>
196+
<TableRow label='Address' noWrapLabel>
191197
<PostalAddress address={groupDetails.data?.group.address} />
192198
</TableRow>
193199
</tbody>
@@ -204,12 +210,12 @@ const InnerGroupPage: FC<GroupPageProps> = ({
204210
</div>
205211
</div>
206212

207-
<div className=' max-w-2xl mx-auto px-10 py-4 bg-gray-100 rounded-md my-4'>
213+
<div className='max-w-2xl mx-auto px-10 py-4 bg-gray-100 rounded-md my-4'>
208214
<h2 className='text-lg font-bold mb-2'>Sequences available in {databaseName}</h2>
209215
<table className='w-full'>
210216
<tbody>
211217
{organisms.map((organism) => (
212-
<TableRow key={organism.key} label={organism.displayName}>
218+
<TableRow key={organism.key} label={organism.displayName} noWrapChildren>
213219
{sequenceCountsLoading ? (
214220
<span className='loading loading-spinner loading-xs'></span>
215221
) : (
@@ -320,13 +326,25 @@ const PostalAddress: FC<{ address: Address | undefined }> = ({ address }) => {
320326
);
321327
};
322328

323-
const TableRow = ({ label, children }: { label: string | undefined; children: ReactNode }) => (
329+
const TableRow = ({
330+
label,
331+
children,
332+
noWrapLabel = false,
333+
noWrapChildren = false,
334+
}: {
335+
label: string | undefined;
336+
children: ReactNode;
337+
noWrapLabel?: boolean;
338+
noWrapChildren?: boolean;
339+
}) => (
324340
<tr className='border-b border-gray-200'>
325341
<td className='py-2 pr-4 text-right align-top'>
326-
<span className='text-lg font-semibold text-gray-800'>{label}</span>
342+
<span className={`text-lg font-semibold text-gray-800 ${noWrapLabel ? 'whitespace-nowrap' : ''}`}>
343+
{label}
344+
</span>
327345
</td>
328346
<td className='py-2 pl-4'>
329-
<span className='text-lg text-gray-900'>{children}</span>
347+
<span className={`text-lg text-gray-900 ${noWrapChildren ? 'whitespace-nowrap' : ''}`}>{children}</span>
330348
</td>
331349
</tr>
332350
);

0 commit comments

Comments
 (0)