11"use client" ;
22
3+ import React , { useState } from "react" ;
34import { LoadingOverlay } from "@/components/LoadingOverlay" ;
45import { MessageDialog } from "@/components/MessageDialog" ;
56import { Box , Button , TextField , Typography , useMediaQuery , useTheme } from "@mui/material" ;
6- import React , { useState } from "react " ;
7+ import { InputSection , GridSection , SectionTitle , FieldTitle , FieldDescription } from "./sections " ;
78import AccountBoxIcon from "@mui/icons-material/AccountBox" ;
89import LinkIcon from "@mui/icons-material/Link" ;
910import MailOutlineIcon from "@mui/icons-material/MailOutline" ;
@@ -12,75 +13,6 @@ import LocationOnIcon from "@mui/icons-material/LocationOn";
1213import TocIcon from "@mui/icons-material/Toc" ;
1314import LanguageIcon from "@mui/icons-material/Language" ;
1415
15- const InputSection = ( { children } : { children : React . ReactNode [ ] } ) => (
16- < Box
17- sx = { {
18- display : "flex" ,
19- flexDirection : "column" ,
20- gap : 2 ,
21- height : "100%" ,
22- } }
23- >
24- { children }
25- </ Box >
26- ) ;
27-
28- const GridSection = ( {
29- children,
30- isDesktop,
31- } : {
32- children : React . ReactNode ;
33- isDesktop : boolean ;
34- } ) => (
35- < Box
36- sx = { {
37- display : "grid" ,
38- gridTemplateColumns : isDesktop ? "1fr 1fr" : "1fr" ,
39- gap : isDesktop ? 4 : 2 ,
40- mt : 4 ,
41- } }
42- >
43- { children }
44- </ Box >
45- ) ;
46-
47- const SectionTitle = ( { children } : { children : React . ReactNode } ) => (
48- < Typography
49- variant = "h5"
50- component = "h2"
51- color = "textPrimary"
52- sx = { {
53- gridColumn : "1 / -1" ,
54- borderTop : "1px solid" ,
55- paddingTop : 2 ,
56- marginTop : 2 ,
57- } }
58- >
59- { children }
60- </ Typography >
61- ) ;
62-
63- const FieldTitle = ( { children } : { children : React . ReactNode } ) => (
64- < Typography
65- variant = "h6"
66- component = "p"
67- color = "textPrimary"
68- sx = { {
69- display : "flex" ,
70- alignItems : "center" ,
71- gap : "0.5em" ,
72- } }
73- >
74- { children }
75- </ Typography >
76- ) ;
77-
78- const FieldDescription = ( { children } : { children : React . ReactNode } ) => (
79- < Typography variant = "body2" color = "textSecondary" >
80- { children }
81- </ Typography >
82- ) ;
83-
8416const AccountForm = ( {
8517 name,
8618 slug,
@@ -107,13 +39,14 @@ const AccountForm = ({
10739 siteTitle,
10840 siteDescription,
10941 } ) ;
110- const theme = useTheme ( ) ;
111- const isDesktop = useMediaQuery ( theme . breakpoints . up ( "md" ) ) ;
112-
11342 const [ errors , setErrors ] = useState < { name ?: string ; slug ?: string ; displayEmail ?: string } > ( { } ) ;
11443 const [ loading , setLoading ] = useState ( false ) ;
11544 const [ message , setMessage ] = useState ( "" ) ;
11645
46+ // Used for styling.
47+ const theme = useTheme ( ) ;
48+ const isDesktop = useMediaQuery ( theme . breakpoints . up ( "md" ) ) ;
49+
11750 const handleChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
11851 const { name, value } = e . target ;
11952
0 commit comments