Skip to content

Commit c2f02be

Browse files
committed
Fix table scrolling issue on smaller screens
1 parent 8a83987 commit c2f02be

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

components/courses-table/details-row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const DetailsRow = ({course, onlyShowSections, onShowEverything, onShareCourse}:
4545
<Collapse in={!onlyShowSections} style={{width: '100%'}} unmountOnExit>
4646
<VStack spacing={10} align="flex-start" w="full">
4747
<VStack spacing={4} align="flex-start" w="full">
48-
<HStack p={1} w="full">
48+
<HStack w="full">
4949
<Text whiteSpace="normal">
5050
<b>Description: </b>
5151
{course.course.description}

components/courses-table/index.tsx

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useCallback, useEffect} from 'react';
2-
import {Table, Thead, Tbody, Tr, Th, VStack, useBreakpointValue, TableContainer, useToast} from '@chakra-ui/react';
2+
import {Table, Thead, Tbody, Tr, Th, VStack, useBreakpointValue, useToast} from '@chakra-ui/react';
33
import {observer} from 'mobx-react-lite';
44
import useStore from '../../lib/state-context';
55
import TableRow from './row';
@@ -95,30 +95,28 @@ const CoursesTable = ({onScrollToTop}: {onScrollToTop: () => void}) => {
9595
updatedAt={store.apiState.dataLastUpdatedAt}
9696
label="courses"
9797
/>
98-
<TableContainer w="100%" p={1}>
99-
<Table variant="simple" boxShadow="base" borderRadius="md" size={tableSize}>
100-
<TablePageControls
101-
page={page}
102-
pageSize={pageSize}
103-
setPage={setPage}
104-
isEnabled={store.apiState.hasDataForTrackedEndpoints}
105-
numberOfPages={numberOfPages}
106-
onPageSizeChange={handlePageSizeChange}
107-
availableSizes={availableSizes}
108-
/>
98+
<Table variant="simple" boxShadow="base" borderRadius="md" size={tableSize} w="full">
99+
<TablePageControls
100+
page={page}
101+
pageSize={pageSize}
102+
setPage={setPage}
103+
isEnabled={store.apiState.hasDataForTrackedEndpoints}
104+
numberOfPages={numberOfPages}
105+
onPageSizeChange={handlePageSizeChange}
106+
availableSizes={availableSizes}
107+
/>
109108

110-
<Thead>
111-
<Tr>
112-
<Th>Course</Th>
113-
<Th>Title</Th>
114-
<Th isNumeric>Credits</Th>
115-
<Th display={{base: 'none', md: 'table-cell'}}>Description</Th>
116-
<Th style={{textAlign: 'right'}}>Details</Th>
117-
</Tr>
118-
</Thead>
119-
<TableBody startAt={startAt} endAt={endAt} onShareCourse={handleShareCourse}/>
120-
</Table>
121-
</TableContainer>
109+
<Thead>
110+
<Tr>
111+
<Th>Course</Th>
112+
<Th>Title</Th>
113+
<Th isNumeric>Credits</Th>
114+
<Th display={{base: 'none', md: 'table-cell'}}>Description</Th>
115+
<Th style={{textAlign: 'right'}}>Details</Th>
116+
</Tr>
117+
</Thead>
118+
<TableBody startAt={startAt} endAt={endAt} onShareCourse={handleShareCourse}/>
119+
</Table>
122120
</VStack>
123121
);
124122
};

0 commit comments

Comments
 (0)