Skip to content

Commit

Permalink
Fix table scrolling issue on smaller screens
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Jun 2, 2021
1 parent 8a83987 commit c2f02be
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion components/courses-table/details-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DetailsRow = ({course, onlyShowSections, onShowEverything, onShareCourse}:
<Collapse in={!onlyShowSections} style={{width: '100%'}} unmountOnExit>
<VStack spacing={10} align="flex-start" w="full">
<VStack spacing={4} align="flex-start" w="full">
<HStack p={1} w="full">
<HStack w="full">
<Text whiteSpace="normal">
<b>Description: </b>
{course.course.description}
Expand Down
46 changes: 22 additions & 24 deletions components/courses-table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useCallback, useEffect} from 'react';
import {Table, Thead, Tbody, Tr, Th, VStack, useBreakpointValue, TableContainer, useToast} from '@chakra-ui/react';
import {Table, Thead, Tbody, Tr, Th, VStack, useBreakpointValue, useToast} from '@chakra-ui/react';
import {observer} from 'mobx-react-lite';
import useStore from '../../lib/state-context';
import TableRow from './row';
Expand Down Expand Up @@ -95,30 +95,28 @@ const CoursesTable = ({onScrollToTop}: {onScrollToTop: () => void}) => {
updatedAt={store.apiState.dataLastUpdatedAt}
label="courses"
/>
<TableContainer w="100%" p={1}>
<Table variant="simple" boxShadow="base" borderRadius="md" size={tableSize}>
<TablePageControls
page={page}
pageSize={pageSize}
setPage={setPage}
isEnabled={store.apiState.hasDataForTrackedEndpoints}
numberOfPages={numberOfPages}
onPageSizeChange={handlePageSizeChange}
availableSizes={availableSizes}
/>
<Table variant="simple" boxShadow="base" borderRadius="md" size={tableSize} w="full">
<TablePageControls
page={page}
pageSize={pageSize}
setPage={setPage}
isEnabled={store.apiState.hasDataForTrackedEndpoints}
numberOfPages={numberOfPages}
onPageSizeChange={handlePageSizeChange}
availableSizes={availableSizes}
/>

<Thead>
<Tr>
<Th>Course</Th>
<Th>Title</Th>
<Th isNumeric>Credits</Th>
<Th display={{base: 'none', md: 'table-cell'}}>Description</Th>
<Th style={{textAlign: 'right'}}>Details</Th>
</Tr>
</Thead>
<TableBody startAt={startAt} endAt={endAt} onShareCourse={handleShareCourse}/>
</Table>
</TableContainer>
<Thead>
<Tr>
<Th>Course</Th>
<Th>Title</Th>
<Th isNumeric>Credits</Th>
<Th display={{base: 'none', md: 'table-cell'}}>Description</Th>
<Th style={{textAlign: 'right'}}>Details</Th>
</Tr>
</Thead>
<TableBody startAt={startAt} endAt={endAt} onShareCourse={handleShareCourse}/>
</Table>
</VStack>
);
};
Expand Down

1 comment on commit c2f02be

@vercel
Copy link

@vercel vercel bot commented on c2f02be Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.