Browse Source

feat: Update on action buttons

Pavle Marceta 2 năm trước cách đây
mục cha
commit
6f131bb3f2
1 tập tin đã thay đổi với 31 bổ sung28 xóa
  1. 31 28
      gui/src/ScenarioSelector.tsx

+ 31 - 28
gui/src/ScenarioSelector.tsx

@@ -115,6 +115,8 @@ const FlagSx = {
   fontSize: "11px",
 };
 
+const ActionContentSx = { mr: 2, ml: 2 };
+
 const ScenarioNodesContent = ({
   label,
   openEditDialog,
@@ -215,6 +217,10 @@ const DialogContentSx = {
   width: "500px",
 };
 
+const CancelBtnSx = {
+  mr: 2,
+};
+
 const ScenarioSelector = (props: ScenarioSelectorProps) => {
   const { id = "", scenarios = [], propagate = true } = props;
   const [open, setOpen] = useState(false);
@@ -575,14 +581,9 @@ const ScenarioSelector = (props: ScenarioSelectorProps) => {
           </DialogContent>
 
           <DialogActions>
-            <Grid
-              container
-              justifyContent="space-between"
-              spacing={2}
-              sx={{ mr: 2, ml: 0 }}
-            >
-              <Grid item>
-                {actionEdit && (
+            <Grid container justifyContent="space-between" sx={ActionContentSx}>
+              {actionEdit && (
+                <Grid item xs={6}>
                   <Button
                     variant="outlined"
                     color="primary"
@@ -590,26 +591,28 @@ const ScenarioSelector = (props: ScenarioSelectorProps) => {
                   >
                     DELETE
                   </Button>
-                )}
-              </Grid>
-              <Grid item>
-                <Button
-                  variant="outlined"
-                  onClick={onDialogClose}
-                  sx={{ mr: 1 }}
-                >
-                  CANCEL
-                </Button>
-              </Grid>
-
-              <Grid item>
-                <Button
-                  variant="contained"
-                  type="submit"
-                  disabled={!form.values.config || !form.values.name}
-                >
-                  {actionEdit ? "APPLY" : "CREATE"}
-                </Button>
+                </Grid>
+              )}
+              <Grid
+                item
+                container
+                xs={actionEdit ? 6 : 12}
+                justifyContent="flex-end"
+              >
+                <Grid item sx={CancelBtnSx}>
+                  <Button variant="outlined" onClick={onDialogClose}>
+                    CANCEL
+                  </Button>
+                </Grid>
+                <Grid item>
+                  <Button
+                    variant="contained"
+                    type="submit"
+                    disabled={!form.values.config || !form.values.name}
+                  >
+                    {actionEdit ? "APPLY" : "CREATE"}
+                  </Button>
+                </Grid>
               </Grid>
             </Grid>
           </DialogActions>