Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Aug 15, 2024
1 parent ec9023b commit d819bbb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
21 changes: 14 additions & 7 deletions src/pages/fruitDetail/FruitDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as forms from "codeforlife/components/form"
import * as pages from "codeforlife/components/page"
import * as yup from "yup"
import { Stack, Typography } from "@mui/material"
import { type FC } from "react"
import { Link } from "codeforlife/components/router"
import { Typography } from "@mui/material"
import { handleQueryState } from "codeforlife/utils/api"
import { submitForm } from "codeforlife/utils/form"
import { useParamsRequired } from "codeforlife/hooks"
Expand Down Expand Up @@ -37,12 +37,19 @@ const FruitDetail: FC<FruitDetailProps> = () => {
},
})}
>
<forms.TextField name="name" schema={fruitNameSchema} />
<forms.CheckboxField
name="is_citrus"
formControlLabelProps={{ label: "Is Citrus" }}
/>
<forms.SubmitButton>Update fruit</forms.SubmitButton>
<Stack>
<forms.TextField
name="name"
label="Name"
placeholder="Enter the fruit's name"
schema={fruitNameSchema}
/>
<forms.CheckboxField
name="is_citrus"
formControlLabelProps={{ label: "Is Citrus" }}
/>
<forms.SubmitButton>Update fruit</forms.SubmitButton>
</Stack>
</forms.Form>
<Link className="back-to" to={paths.fruits._}>
fruit list
Expand Down
22 changes: 15 additions & 7 deletions src/pages/fruitList/CreateFruitForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as forms from "codeforlife/components/form"
import { FormHelperText, Stack } from "@mui/material"
import { type FC } from "react"
import { FormHelperText } from "@mui/material"
import { submitForm } from "codeforlife/utils/form"

import { fruitNameSchema } from "../../app/schemas"
Expand All @@ -24,12 +24,20 @@ const CreateFruitForm: FC<CreateFruitFormProps> = () => {
},
})}
>
<forms.TextField required name="name" schema={fruitNameSchema} />
<forms.CheckboxField
name="is_citrus"
formControlLabelProps={{ label: "Is Citrus" }}
/>
<forms.SubmitButton>Create fruit</forms.SubmitButton>
<Stack>
<forms.TextField
required
name="name"
label="Name"
placeholder="Enter the fruit's name"
schema={fruitNameSchema}
/>
<forms.CheckboxField
name="is_citrus"
formControlLabelProps={{ label: "Is Citrus" }}
/>
<forms.SubmitButton>Create fruit</forms.SubmitButton>
</Stack>
</forms.Form>
</>
)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const Home: FC<HomeProps> = () => {
return (
<pages.Page>
<pages.Section>
<Image src={CflLogoImage} alt="code for life logo" />
<Image src={CflLogoImage} alt="code for life logo" maxWidth="200px" />
<Typography variant="h1">Example web page</Typography>
<Typography>
This is an example of how you can create a web page. This example
consumes the backend-template's API.
</Typography>
<Link to={paths.fruits._}>See fruits</Link>
<Link to={paths.fruits._}>Fruit list</Link>
</pages.Section>
</pages.Page>
)
Expand Down

0 comments on commit d819bbb

Please sign in to comment.