-
Notifications
You must be signed in to change notification settings - Fork 928
feat: UX - Initial create form flow #33
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
18dd18f
7329cca
6726f40
3f932c2
6fdb43f
97b2383
086d533
82989d3
c305c8d
cc411d0
907a523
56f7515
0a5c48a
aea58ae
c92e454
be4c90f
308de2b
d0b0ef1
797c82b
5016b9a
8da382b
6fc0a54
e57d1b6
08010c3
8800445
496b42e
646206e
4b6f1c5
961a44b
eb46f4c
840a796
f20171f
03236df
61cd37f
99d0a95
d52bd38
76d11d4
ffac475
e95d75f
3e8069b
9492e8e
e5e02f9
5e4a44f
6fe7141
8343ef0
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import React from "react" | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
row: { | ||
marginTop: theme.spacing(2), | ||
marginBottom: theme.spacing(2), | ||
}, | ||
})) | ||
|
||
export const FormRow: React.FC = ({ children }) => { | ||
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. Do we believe it's safe to say all of our Form instances will follow a similar format? I have lots of hesitancy over a top-level form component. If we even have a single form that doesn't consume it, this top-level component abstraction has broken. I'm not sure of an alternative though, so maybe this is required! 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. I think this is a good point for this component - it's only used in one places so I can bring it inline. |
||
const styles = useStyles() | ||
return <div className={styles.row}>{children}</div> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import Typography from "@material-ui/core/Typography" | ||
import React from "react" | ||
|
||
export interface FormSectionProps { | ||
title: string | ||
description?: string | ||
} | ||
|
||
export const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
display: "flex", | ||
flexDirection: "row", | ||
// Borrowed from PaperForm styles | ||
maxWidth: "852px", | ||
width: "100%", | ||
borderBottom: `1px solid ${theme.palette.divider}`, | ||
}, | ||
descriptionContainer: { | ||
maxWidth: "200px", | ||
flex: "0 0 200px", | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "flex-start", | ||
alignItems: "flex-start", | ||
marginTop: theme.spacing(5), | ||
marginBottom: theme.spacing(2), | ||
}, | ||
descriptionText: { | ||
fontSize: "0.9em", | ||
lineHeight: "1em", | ||
color: theme.palette.text.secondary, | ||
marginTop: theme.spacing(1), | ||
}, | ||
contents: { | ||
flex: 1, | ||
marginTop: theme.spacing(2), | ||
marginBottom: theme.spacing(2), | ||
}, | ||
})) | ||
|
||
export const FormSection: React.FC<FormSectionProps> = ({ title, description, children }) => { | ||
const styles = useStyles() | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<div className={styles.descriptionContainer}> | ||
<Typography variant="h5" color="textPrimary"> | ||
{title} | ||
</Typography> | ||
{description && ( | ||
<Typography className={styles.descriptionText} variant="body2" color="textSecondary"> | ||
{description} | ||
</Typography> | ||
)} | ||
</div> | ||
<div className={styles.contents}>{children}</div> | ||
</div> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import Typography from "@material-ui/core/Typography" | ||
import React from "react" | ||
|
||
export interface TitleProps { | ||
title: string | ||
detail: React.ReactNode | ||
} | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
title: { | ||
textAlign: "center", | ||
marginTop: theme.spacing(5), | ||
marginBottom: theme.spacing(5), | ||
|
||
"& h3": { | ||
marginBottom: theme.spacing(1), | ||
}, | ||
}, | ||
})) | ||
|
||
export const Title: React.FC<TitleProps> = ({ title, detail }) => { | ||
const styles = useStyles() | ||
|
||
return ( | ||
<div className={styles.title}> | ||
<Typography variant="h3">{title}</Typography> | ||
<Typography variant="caption">{detail}</Typography> | ||
</div> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./FormRow" | ||
export * from "./FormSection" | ||
export * from "./FormTextField" | ||
export * from "./FormTitle" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FormikLike } from "../../util/formik" | ||
bryphe-coder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* FormFieldProps are required props for creating form fields using a factory. | ||
*/ | ||
export interface FormFieldProps<T> { | ||
/** | ||
* form is a reference to a form or subform and is used to compute common | ||
* states such as error and helper text | ||
*/ | ||
form: FormikLike<T> | ||
/** | ||
* formFieldName is a field name associated with the form schema. | ||
*/ | ||
formFieldName: keyof T | ||
} |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.