diff options
Diffstat (limited to 'bs5/universal/native/shared/ServerActionWithFormDataWithArg.re')
-rw-r--r-- | bs5/universal/native/shared/ServerActionWithFormDataWithArg.re | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bs5/universal/native/shared/ServerActionWithFormDataWithArg.re b/bs5/universal/native/shared/ServerActionWithFormDataWithArg.re new file mode 100644 index 0000000..2196f80 --- /dev/null +++ b/bs5/universal/native/shared/ServerActionWithFormDataWithArg.re @@ -0,0 +1,27 @@ +[@react.client.component] +let make = () => { + <form + action={ + switch%platform () { + | Server => `String("") + | Client => + Obj.magic( + ServerFunctions.formDataWithArg.call( + Js.Date.now() |> string_of_float, + ), + ) + } + } + className={Cx.make([Theme.text(Theme.Color.Gray4)])}> + <input + name="country" + className="w-full mb-2 font-sans border border-gray-300 py-2 px-4 rounded-md bg-white text-gray-900 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition duration-200" + placeholder="Name" + /> + <button + className="font-mono border-2 py-1 px-2 rounded-lg bg-yellow-950 border-yellow-700 text-yellow-200 hover:bg-yellow-800" + type_="submit"> + {React.string("Send Form Data")} + </button> + </form>; +}; |