Created
January 20, 2022 01:43
-
-
Save RoyalIcing/d4c4bef2f0063defadf4498ae0feefa8 to your computer and use it in GitHub Desktop.
Remorse: Focused on web fundamentals and archaic UX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function loader($request) { | |
return getProjects(); | |
} | |
function action($request) { | |
$form = $request.formData(); | |
return createProject([ "title" => $form.get("title") ]); | |
} | |
function Projects($request) { | |
$projects = loader($loader); | |
$state = useTransition($request)["state"]; | |
$busy = $state == "submitting"; | |
?> | |
<div> | |
<?php foreach($projects as $project) { ?> | |
<a href="<?= $project.slug ?>"><?= $project.title ?></a> | |
<?php } ?> | |
<form method="post"> | |
<input name="title"> | |
<button type="submit" disabled="<?= $busy ?>"> | |
<?= $busy ? "Creating..." : "Create New Project"; ?> | |
</button> | |
</form> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment