FPSMS-frontend
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

104 行
2.7 KiB

  1. "use client";
  2. import { UserResult } from "@/app/api/user";
  3. import { UserInputs } from "@/app/api/user/actions";
  4. import {
  5. Card,
  6. CardContent,
  7. Grid,
  8. Stack,
  9. TextField,
  10. Typography,
  11. makeStyles,
  12. } from "@mui/material";
  13. import { useFormContext } from "react-hook-form";
  14. import { useTranslation } from "react-i18next";
  15. const UserDetail: React.FC = () => {
  16. const { t } = useTranslation();
  17. const {
  18. register,
  19. formState: { errors },
  20. control,
  21. } = useFormContext<UserInputs>();
  22. return (
  23. <Card>
  24. <CardContent component={Stack} spacing={4}>
  25. <Typography variant="overline" display="block" marginBlockEnd={1}>
  26. {t("User Detail")}
  27. </Typography>
  28. <Grid container spacing={2} columns={{ xs: 6, sm: 12 }}>
  29. <Grid item xs={6}>
  30. <TextField
  31. label={t("username")}
  32. fullWidth
  33. {...register("username", {
  34. required: "username required!",
  35. })}
  36. error={Boolean(errors.username)}
  37. />
  38. </Grid>
  39. <Grid item xs={6}>
  40. <TextField
  41. label={t("password")}
  42. fullWidth
  43. {...register("password")}
  44. // helperText={
  45. // Boolean(errors.password) &&
  46. // (errors.password?.message
  47. // ? t(errors.password.message)
  48. // :
  49. // (<>
  50. // - 8-20 characters
  51. // <br/>
  52. // - Uppercase letters
  53. // <br/>
  54. // - Lowercase letters
  55. // <br/>
  56. // - Numbers
  57. // <br/>
  58. // - Symbols
  59. // </>)
  60. // )
  61. // }
  62. helperText={
  63. Boolean(errors.password) &&
  64. (errors.password?.message
  65. ? t(errors.password.message)
  66. : t("Please input correct password"))
  67. }
  68. error={Boolean(errors.password)}
  69. />
  70. </Grid>
  71. {/* <Grid item xs={6}>
  72. <TextField
  73. label={t("name")}
  74. fullWidth
  75. {...register("name", {
  76. required: "name required!",
  77. })}
  78. error={Boolean(errors.name)}
  79. />
  80. </Grid> */}
  81. </Grid>
  82. </CardContent>
  83. </Card>
  84. );
  85. };
  86. export default UserDetail;
  87. {/* <>
  88. - 8-20 characters
  89. <br/>
  90. - Uppercase letters
  91. <br/>
  92. - Lowercase letters
  93. <br/>
  94. - Numbers
  95. <br/>
  96. - Symbols
  97. </> */}