You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.9 KiB

5 months ago
  1. import React, { useMemo, useState } from "react";
  2. import { View } from "react-native";
  3. import ETextInput, { ETextInputBorder } from "@components/ETextInput";
  4. import EFullButton from "@components/EButton";
  5. import EText, { ECaptionText, ELabelText, ETitleText } from "@components/EText";
  6. import ENavButtons from "@components/ENavButtons";
  7. // implement logic here later.
  8. export default function CreatePassword(props: any) {
  9. const [password, setPassword] = useState<string>("");
  10. const [validation, setValidation] = useState<string>("");
  11. const [visible, setVisible] = useState<boolean>(true);
  12. const border = useMemo(() => {
  13. if (password.length === 0 && validation.length === 0)
  14. return ETextInputBorder.Nothing;
  15. if (validation !== password) return ETextInputBorder.Fail;
  16. if (validation.length >= 8) return ETextInputBorder.Success;
  17. return ETextInputBorder.Fail;
  18. }, [password, validation]);
  19. return (
  20. <>
  21. <View
  22. style={{
  23. flex: 1,
  24. flexDirection: "column",
  25. }}
  26. >
  27. <ENavButtons back={true} />
  28. <View style={{ flexDirection: "column", marginTop: 0 }}>
  29. <View style={{ marginBottom: 24 }}>
  30. <ETitleText style={{ marginBottom: 8 }}>
  31. </ETitleText>
  32. <EText>
  33. . , 8
  34. </EText>
  35. </View>
  36. <View style={{ rowGap: 8 }}>
  37. <ELabelText></ELabelText>
  38. <ETextInput
  39. border={border}
  40. placeholder=""
  41. value={password}
  42. setValue={setPassword}
  43. passwordHidden={visible}
  44. setPasswordHidden={setVisible}
  45. />
  46. <ETextInput
  47. border={border}
  48. placeholder="비밀번호 다시 입력하기"
  49. value={validation}
  50. setValue={setValidation}
  51. passwordHidden={visible}
  52. setPasswordHidden={setVisible}
  53. />
  54. {border === ETextInputBorder.Nothing && (
  55. <ECaptionText>
  56. / 8
  57. </ECaptionText>
  58. )}
  59. {border === ETextInputBorder.Fail && (
  60. <>
  61. <ECaptionText error={true}>
  62. / 8
  63. </ECaptionText>
  64. <ECaptionText error={true}>
  65. </ECaptionText>
  66. </>
  67. )}
  68. </View>
  69. </View>
  70. <EFullButton
  71. style={{ marginTop: 24 }}
  72. text="비밀번호 설정하기"
  73. active={border == ETextInputBorder.Success}
  74. />
  75. </View>
  76. </>
  77. );
  78. }