Skip to content

Commit 71751c8

Browse files
authored
Merge pull request #3226 from andrewbaldwin44/task/fix-column-selector
Fix Alignment of View Column Selector
2 parents 01c235f + bcfe61c commit 71751c8

File tree

4 files changed

+32
-25
lines changed

4 files changed

+32
-25
lines changed

locust/webui/src/components/Layout/Footer/FeedbackForm.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useState } from 'react';
2+
import SendIcon from '@mui/icons-material/Send';
23
import { Alert, Box, Button, TextField, Typography } from '@mui/material';
34

45
import Form from 'components/Form/Form';
@@ -67,18 +68,27 @@ export default function FeedbackForm() {
6768
</Typography>
6869
</Box>
6970
) : (
70-
<Form<IFeedbackForm> onSubmit={onSubmitFeedback}>
71-
<Box sx={{ display: 'flex', flexDirection: 'column', rowGap: 2, my: 2 }}>
72-
<TextField label='Email' name='email' required type='email' />
73-
<TextField label='Name' name='name' />
74-
<TextField label='Message' multiline name='message' required rows={3} />
75-
{!!errorMessage && <Alert severity='error'>{errorMessage}</Alert>}
71+
<Box>
72+
<Typography sx={{ mb: 3, mt: 1 }} variant='h6'>
73+
Send us your feedback
74+
</Typography>
75+
<Form<IFeedbackForm> onSubmit={onSubmitFeedback}>
76+
<Box sx={{ display: 'flex', flexDirection: 'column', rowGap: 2, my: 2 }}>
77+
<TextField label='Email' name='email' required type='email' />
78+
<TextField label='Name' name='name' />
79+
<TextField label='Message' multiline name='message' required rows={3} />
80+
{!!errorMessage && <Alert severity='error'>{errorMessage}</Alert>}
7681

77-
<LoadingButton isLoading={isLoading} type='submit'>
78-
Submit
79-
</LoadingButton>
80-
</Box>
81-
</Form>
82+
<LoadingButton
83+
isLoading={isLoading}
84+
sx={{ display: 'flex', columnGap: 2 }}
85+
type='submit'
86+
>
87+
Send <SendIcon sx={{ mt: -0.5 }} />
88+
</LoadingButton>
89+
</Box>
90+
</Form>
91+
</Box>
8292
)}
8393
</Modal>
8494
</>

locust/webui/src/components/Modal/Modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function Modal({ open, onClose, children }: IModal) {
2626
boxShadow: 24,
2727
borderRadius: 4,
2828
border: '3px solid black',
29+
width: { xs: '95vw' },
2930
p: 4,
3031
}}
3132
>

locust/webui/src/components/StatsTable/StatsTable.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Box } from '@mui/material';
2-
31
import Table from 'components/Table/Table';
42
import ViewColumnSelector from 'components/ViewColumnSelector/ViewColumnSelector';
53
import { swarmTemplateArgs } from 'constants/swarm';
@@ -39,20 +37,14 @@ export default function StatsTable({ stats, tableStructure = baseTableStructure
3937
useSelectViewColumns(tableStructure);
4038

4139
return (
42-
<Box
43-
sx={{
44-
display: 'flex',
45-
flexDirection: { xs: 'column', lg: 'row-reverse', alignItems: 'flex-start' },
46-
columnGap: 1,
47-
}}
48-
>
40+
<>
4941
<ViewColumnSelector
5042
addColumn={addColumn}
5143
removeColumn={removeColumn}
5244
selectedColumns={selectedColumns}
5345
structure={tableStructure}
5446
/>
5547
<Table<ISwarmStat> hasTotalRow rows={stats} structure={filteredStructure} />
56-
</Box>
48+
</>
5749
);
5850
}

locust/webui/src/components/ViewColumnSelector/ViewColumnSelector.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from 'react';
22
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
3-
import { Button, FormControlLabel, FormGroup, Popover, Stack, Switch } from '@mui/material';
3+
import { Box, Button, FormControlLabel, FormGroup, Popover, Switch } from '@mui/material';
44

55
import { ITableStructure } from 'types/table.types';
66

@@ -20,18 +20,22 @@ function ViewColumnSelector({
2020
const [anchorEl, setAnchorEl] = useState(null as HTMLButtonElement | null);
2121

2222
return (
23-
<Stack sx={{ alignSelf: { xs: 'end', lg: 'start' }, my: 2 }}>
23+
<Box sx={{ display: 'flex', justifyContent: 'flex-end', my: 2 }}>
2424
<Button onClick={event => setAnchorEl(event.currentTarget)} variant='outlined'>
2525
<ViewColumnIcon />
2626
</Button>
2727
<Popover
2828
anchorEl={anchorEl}
2929
anchorOrigin={{
3030
vertical: 'bottom',
31-
horizontal: 'left',
31+
horizontal: 'right',
3232
}}
3333
onClose={() => setAnchorEl(null)}
3434
open={Boolean(anchorEl)}
35+
transformOrigin={{
36+
vertical: 'top',
37+
horizontal: 'right',
38+
}}
3539
>
3640
<FormGroup sx={{ p: 2 }}>
3741
{structure.map(({ key, title }) => (
@@ -54,7 +58,7 @@ function ViewColumnSelector({
5458
))}
5559
</FormGroup>
5660
</Popover>
57-
</Stack>
61+
</Box>
5862
);
5963
}
6064

0 commit comments

Comments
 (0)