Skip to content

Commit b17b4db

Browse files
committed
#1578: Made bottom section sticky and other code style fixes
1 parent f24e683 commit b17b4db

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
Typography,
1313
Snackbar,
1414
Alert,
15-
Button
15+
Button,
16+
useTheme
1617
} from '@mui/material';
1718
import { Box, Stack } from '@mui/system';
1819
import { Control, Controller, FieldErrors, UseFormHandleSubmit, UseFormSetValue, UseFormWatch } from 'react-hook-form';
@@ -86,6 +87,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
8687
}) => {
8788
const [datePickerOpen, setDatePickerOpen] = useState(false);
8889
const toast = useToast();
90+
const theme = useTheme();
8991
const products = watch(`reimbursementProducts`);
9092
const expenseTypeId = watch('expenseTypeId');
9193
const selectedExpenseType = allExpenseTypes.find((expenseType) => expenseType.expenseTypeId === expenseTypeId);
@@ -143,7 +145,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
143145
)}
144146
<Grid container spacing={2}>
145147
<Grid item container spacing={2} md={6} xs={12} sx={{ '&.MuiGrid-item': { height: 'fit-content' } }}>
146-
<Grid item xs={12} sx={{}}>
148+
<Grid item xs={12}>
147149
<FormControl fullWidth>
148150
<FormLabel>Purchased From</FormLabel>
149151
<Controller
@@ -308,18 +310,29 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
308310
</FormControl>
309311
</Grid>
310312
</Grid>
311-
<Grid item xs={12}>
313+
<Box
314+
sx={{
315+
position: 'sticky',
316+
bottom: 0,
317+
background: theme.palette.background.default,
318+
paddingY: 1,
319+
borderTop: `solid 1px ${theme.palette.divider}`,
320+
321+
zIndex: 1,
322+
mt: 2
323+
}}
324+
>
312325
<FormLabel>Total Cost</FormLabel>
313326
<Typography variant="h6">${calculatedTotalCost}</Typography>
314-
<Box sx={{ display: 'flex', justifyContent: 'flex-end', mt: 2 }}>
327+
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
315328
<NERFailButton variant="contained" href={previousPage} sx={{ mx: 1 }}>
316329
Cancel
317330
</NERFailButton>
318331
<NERSuccessButton variant="contained" type="submit" disabled={!hasSecureSettingsSet}>
319332
{submitText}
320333
</NERSuccessButton>
321334
</Box>
322-
</Grid>
335+
</Box>
323336
</form>
324337
);
325338
};

0 commit comments

Comments
 (0)