-
Notifications
You must be signed in to change notification settings - Fork 3
Fix dialog spacing + reset AddToListDialog #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3465373
b1167b5
bea4e4b
d14b551
8be6cc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,3 +137,4 @@ storybook-static/ | |
| !/e2e_testing/.env | ||
|
|
||
| e2e_testing/.yarn/cache | ||
| .swc | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,14 +122,6 @@ const UpsertLearningPathDialog = NiceModal.create( | |
| onSubmit={formik.handleSubmit} | ||
| confirmText="Save" | ||
| noValidate | ||
| footerContent={ | ||
| mutation.isError && | ||
| !formik.isSubmitting && ( | ||
| <Alert severity="error"> | ||
| There was a problem saving your list. Please try again later. | ||
| </Alert> | ||
| ) | ||
| } | ||
| > | ||
| <TextField | ||
| required | ||
|
|
@@ -191,6 +183,11 @@ const UpsertLearningPathDialog = NiceModal.create( | |
| value={formik.values.published} | ||
| onChange={(e) => formik.setFieldValue(e.name, e.value)} | ||
| /> | ||
| {mutation.isError && !formik.isSubmitting && ( | ||
| <Alert severity="error"> | ||
| There was a problem saving your list. Please try again later. | ||
| </Alert> | ||
| )} | ||
|
Comment on lines
+186
to
+190
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </FormDialog> | ||
| ) | ||
| }, | ||
|
|
@@ -242,14 +239,6 @@ const UpsertUserListDialog = NiceModal.create( | |
| onSubmit={formik.handleSubmit} | ||
| confirmText={userList ? "Update" : "Create"} | ||
| noValidate | ||
| footerContent={ | ||
| mutation.isError && | ||
| !formik.isSubmitting && ( | ||
| <Alert severity="error"> | ||
| There was a problem saving your list. Please try again later. | ||
| </Alert> | ||
| ) | ||
| } | ||
| > | ||
| <TextField | ||
| required | ||
|
|
@@ -277,6 +266,11 @@ const UpsertUserListDialog = NiceModal.create( | |
| multiline | ||
| minRows={3} | ||
| /> | ||
| {mutation.isError && !formik.isSubmitting && ( | ||
| <Alert severity="error"> | ||
| There was a problem saving your list. Please try again later. | ||
| </Alert> | ||
| )} | ||
| {userList && ( | ||
| <div> | ||
| <Button | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,7 +182,16 @@ module.exports = (env, argv) => { | |
| }, | ||
| { | ||
| test: /\.tsx?$/, | ||
| use: "swc-loader", | ||
| use: { | ||
| loader: "swc-loader", | ||
| options: { | ||
| jsc: { | ||
| experimental: { | ||
| plugins: [["@swc/plugin-emotion", {}]], | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
|
Comment on lines
+185
to
+194
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is https://www.npmjs.com/package/@swc/plugin-emotion In particular, in dev mode, this gives us more useful class names. (production is unchanged). Added in this PR in the course of trying to figure out where a style was coming from. |
||
| exclude: /node_modules/, | ||
| }, | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import React, { useCallback, useEffect, useMemo, useState } from "react" | ||
| import styled from "@emotion/styled" | ||
| import { Dialog } from "../Dialog/Dialog" | ||
| import type { DialogProps } from "@mui/material/Dialog" | ||
| import type { DialogProps } from "../Dialog/Dialog" | ||
|
|
||
| const FormContent = styled.div` | ||
| display: flex; | ||
|
|
@@ -50,20 +50,12 @@ interface FormDialogProps { | |
| * The form content. These will be direct children of MUI's [DialogContent](https://mui.com/material-ui/api/dialog-content/) | ||
| */ | ||
| children?: React.ReactNode | ||
| /** | ||
| * Extra content below the cancel/submit buttons. This is useful, e.g., for | ||
| * displaying overall form error messages. | ||
| */ | ||
| footerContent?: React.ReactNode | ||
| actions?: DialogProps["actions"] | ||
| /** | ||
| * Class applied to the `<form />` element. | ||
| */ | ||
| formClassName?: string | ||
|
|
||
| /** | ||
| * MUI Dialog's [TransitionProps](https://mui.com/material-ui/api/dialog/#props) | ||
| */ | ||
| TransitionProps?: DialogProps["TransitionProps"] | ||
|
Comment on lines
-63
to
-66
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should have been removed when we made the dialogs "Slide down from top". |
||
| /** | ||
| * If `true`, the dialog stretches to its `maxWidth`. | ||
| * | ||
|
|
@@ -93,7 +85,7 @@ const FormDialog: React.FC<FormDialogProps> = ({ | |
| title, | ||
| noValidate, | ||
| children, | ||
| footerContent, | ||
| actions, | ||
| confirmText = "Submit", | ||
| cancelText = "Cancel", | ||
| className, | ||
|
|
@@ -139,11 +131,9 @@ const FormDialog: React.FC<FormDialogProps> = ({ | |
| isSubmitting={isSubmitting} | ||
| className={className} | ||
| PaperProps={paperProps} | ||
| actions={actions} | ||
| > | ||
| <FormContent> | ||
| {children} | ||
| {footerContent} | ||
|
Comment on lines
-144
to
-145
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything that (In a previous design, it needed to be separate) |
||
| </FormContent> | ||
| <FormContent>{children}</FormContent> | ||
| </Dialog> | ||
| ) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ const Container = styled.div<{ fullWidth?: boolean }>(({ fullWidth }) => [ | |
| display: "inline-flex", | ||
| flexDirection: "column", | ||
| alignItems: "start", | ||
| "> *": { | ||
| "> *:not(:last-child)": { | ||
| marginBottom: "4px", | ||
|
Comment on lines
-38
to
39
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }, | ||
| }, | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had considered using
FormDialog, but at first it didn't seem necessary since this is barely a form and there's only one input element. This makes sense though, it cleans things up andonResetfixes our issue with the selections persisting.