Skip to content

Commit afe3df1

Browse files
authored
Merge pull request #4195 from eaw-pid/WV-840
WV-840 - "View details" mini modal scrolls horizontally in mobile [TEAM REVIEW]
2 parents 666a8d4 + 84ee810 commit afe3df1

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/js/common/components/ChallengeInviteFriends/ViewInviteeDetails.jsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import withStyles from '@mui/styles/withStyles';
33
import withTheme from '@mui/styles/withTheme';
44
import PropTypes from 'prop-types';
55
import { styled } from '@mui/material/styles';
6-
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper } from '@mui/material';
6+
import { TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, DialogTitle } from '@mui/material';
77
import DesignTokenColors from '../Style/DesignTokenColors';
88
import ModalDisplayTemplateA, { templateAStyles, TextFieldWrapper } from '../../../components/Widgets/ModalDisplayTemplateA';
99
import ChallengeInviteeStore from '../../stores/ChallengeInviteeStore';
@@ -50,7 +50,7 @@ const ViewInviteeDetails = ({ inviteeId, show, setShow, setAnchorEl }) => {
5050
const textFieldJSX = (
5151
<TableContainer components={Paper} sx={{ paddingBottom: '5px' }}>
5252
<TableWrapper>
53-
<Table aria-label="simple table">
53+
<StyledTable aria-label="simple table">
5454
<TableHead>
5555
<StyledTableRow>
5656
<StyledTableHeaderCell>STATUS</StyledTableHeaderCell>
@@ -77,14 +77,14 @@ const ViewInviteeDetails = ({ inviteeId, show, setShow, setAnchorEl }) => {
7777
<StyledTableBodyCellRight align="right">{inviteeData ? formatDate(inviteeData.date_challenge_joined, 'Challenge has not been joined') : 'Challenge has not been joined'}</StyledTableBodyCellRight>
7878
</StyledTableRow>
7979
</TableBody>
80-
</Table>
80+
</StyledTable>
8181
</TableWrapper>
8282
</TableContainer>
8383
);
8484

8585
return (
8686
<ModalDisplayTemplateA
87-
dialogTitleJSX={<TitleWrapper>{dialogTitleText}</TitleWrapper>}
87+
dialogTitleJSX={<DialogTitle>{dialogTitleText}</DialogTitle>}
8888
textFieldJSX={textFieldJSX}
8989
show={show}
9090
tallMode
@@ -100,12 +100,24 @@ ViewInviteeDetails.propTypes = {
100100
uniqueExternalId: PropTypes.string,
101101
};
102102

103+
const StyledTable = styled('table')`
104+
width: 100%;
105+
border-collapse: collapse;
106+
margin-top: 8px;
107+
border-radius: 8px;
108+
overflow: hidden;
109+
`;
110+
103111
const StyledTableHeaderCell = styled(TableCell)`
104112
color: ${DesignTokenColors.neutral900};
105113
font-size: 10px;
106114
font-weight: bold;
107115
font-family: inherit;
108116
padding: 8px 4px 4px 4px;
117+
@media (max-width: 600px) {
118+
font-size: 8px; /* Reduce font size for smaller screens */
119+
padding: 4px; /* Adjust padding for smaller screens */
120+
}
109121
`;
110122

111123
const StyledTableRow = styled(TableRow)`
@@ -129,21 +141,12 @@ const StyledTableBodyCellRight = styled(TableCell)`
129141
padding-right: none;
130142
`;
131143

132-
const TitleWrapper = styled('div')`
133-
font-size: 16px;
134-
font-weight: bold;
135-
padding-bottom: 4px;
136-
padding-left: 4px;
137-
text-align: center;
138-
font-family: inherit;
139-
`;
140-
141144
const TableWrapper = styled('div')`
142-
border-top: 1px solid ${DesignTokenColors.neutral100};
143145
margin-top: 4px; /* Adjust to give space below the title */
144146
margin-bottom: 4px;
145-
min-width: 300px;
146-
overflow-x: auto;
147+
min-width: 100%;
148+
max-width: 100%;
149+
overflow-x: hidden;
147150
`;
148151

149152
export default withTheme(withStyles(templateAStyles)(ViewInviteeDetails));

0 commit comments

Comments
 (0)