Skip to content

Commit 31a3f15

Browse files
committed
client(Options.tsx): the generate button is now disabled when the form includes an error
1 parent 6368b8a commit 31a3f15

File tree

11 files changed

+30
-22
lines changed

11 files changed

+30
-22
lines changed

client/build/asset-manifest.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/static/css/main.72cd8c70.css renamed to client/build/static/css/main.bc85d90e.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/static/css/main.72cd8c70.css.map renamed to client/build/static/css/main.bc85d90e.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/static/js/main.2929b3db.js renamed to client/build/static/js/main.6d95d12c.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/build/static/js/main.2929b3db.js.map renamed to client/build/static/js/main.6d95d12c.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/>
1111
<meta http-equiv="Cache-Control" content="no-store, no-cache" />
1212
<meta http-equiv="Pragma" content="no-cache" />
13-
<meta http-equiv="Expires" content="0" />
13+
<meta http-equiv="Expires" content="0" />
1414
<meta
1515
name="keywords"
1616
content="react, tailwind, tailwindcss, javascript, js,

client/src/components/input/SelectInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const SelectInput: FC<SelectInputProps> = (props) => {
107107
onClick={() => selectValue(option)}
108108
className={`flex items-center gap-4 py-1 px-2 transition-all duration-150
109109
hover:bg-gh-button cursor-pointer text-gh-text min-w-[10rem] ${
110-
i === 0 ? "" : "border-t border-solid border-gh-border"
110+
i === 0 ? "" : "border-t border-solid border-gh-border-dark"
111111
}`}
112112
>
113113
{isSelected && (

client/src/sections/Options.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface OptionsProps {
3131

3232
const Options: FC<OptionsProps> = (props) => {
3333
const themes = useFetchThemes();
34+
const [isGenerateBtnActive, setIsGenerateBtnActive] = useState<boolean>(true);
3435
const [lineChars, setLineChars] = useState(["1"]);
3536

3637
const [title, setTitle] = useRecoilState<string>(titleState);
@@ -151,16 +152,22 @@ const Options: FC<OptionsProps> = (props) => {
151152
const num = parseInt(val);
152153

153154
if (val.trim() === "") {
155+
setIsGenerateBtnActive(false);
154156
return "Please provide a border radius!";
155157
}
156158

157159
if (!val.split("").every((x) => "0123456789.".includes(x))) {
158-
return "Please provide a number!";
160+
setIsGenerateBtnActive(false);
161+
return "Please provide a valid number!";
159162
}
160163

161-
return num > 50 || num < 0
162-
? "Please provide a value between 0 and 50"
163-
: "";
164+
if (num > 50 || num < 0) {
165+
setIsGenerateBtnActive(false);
166+
return "Please provide a value between 0 and 50";
167+
}
168+
169+
setIsGenerateBtnActive(true);
170+
return "";
164171
}}
165172
/>
166173

@@ -208,7 +215,7 @@ const Options: FC<OptionsProps> = (props) => {
208215
)
209216
);
210217
}}
211-
disabled={false}
218+
disabled={!isGenerateBtnActive}
212219
text="Generate"
213220
/>
214221

0 commit comments

Comments
 (0)