Skip to content

Commit

Permalink
Add availability field
Browse files Browse the repository at this point in the history
  • Loading branch information
Willdotwhite committed Jan 23, 2024
1 parent a61e454 commit d2d4bd1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package com.gmtkgamejam.models.posts

enum class Availability {

/**
* Haven't decided/don't know yet
*/
UNSURE,

/**
* A few hours over the whole jam
*/
Expand Down
8 changes: 8 additions & 0 deletions ui/src/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
@apply bg-gray-300 border-2 border-gray-300 rounded-xl placeholder-gray-600 text-gray-900;
}

input[type="radio"] {
appearance: none;
/* For iOS < 15 to remove gradient background */
background-color: #fff;
/* Not removed via appearance */
margin: 0;
}

main {
@apply container mx-auto p-1 px-4 pb-6;
padding-bottom: 96px;
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/mypost/MyPost.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@layer components {
.c-form-block {
.form-block__input {

.form-block__availability {
@apply block sm:inline-block rounded-lg p-2 m-0 mb-2 mr-2 border border-white text-white;
}
}
}
34 changes: 33 additions & 1 deletion ui/src/pages/mypost/MyPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const MyPost: React.FC<{
<FieldTeamSize />
</div>

<FieldAvailability currentAvailability={values.availability} />

<Button
className="mt-4 bg-theme-d-7 rounded-xl w-full sm:w-full md:w-auto md:float-right"
type="button"
Expand All @@ -55,6 +57,8 @@ export const MyPost: React.FC<{
>
{isSubmitting ? "Please wait..." : `${hasPost ? "Update" : "Create"} Post`}
</Button>
{/* Quick workaround to stop Create Post button falling off bottom of form, until we replace float-right */}
<div className="clear-both">&nbsp;</div>
</Form>
)
}
Expand Down Expand Up @@ -185,4 +189,32 @@ const FieldTeamSize: React.FC = () => {
</span>
</div>
)
}
}

const FieldAvailability: React.FC<{currentAvailability: string}> = ({currentAvailability}) => {

const availabilityOptions: CustomSelectOption[] = [
{label: "Not sure/haven't decided", value: "UNSURE"},
{label: "A few hours over the whole jam", value: "MINIMAL"},
{label: "Less than 4 hours per day", value: "PART_TIME"},
{label: "4-8 hours per day", value: "FULL_TIME"},
{label: "As much time as I can", value: "OVERTIME"}
];

return (
<div className="c-form-block bg-black w-full grid-cols-1">
<div id="availability-radio-group">Availability</div>
<div role="group" aria-labelledby="availability-radio-group">
{availabilityOptions.map(option => (
<label
key={option.value}
className={`form-block__availability ${option.value == currentAvailability ? "bg-theme" : "bg-theme-d-4 hover:bg-theme-d-7"}`}
>
<Field type="radio" name="availability" value={option.value} />
{option.label}
</label>
))}
</div>
</div>
)
}
4 changes: 2 additions & 2 deletions ui/src/pages/mypost/MyPostWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const defaultFormValues: Post = {
skillsSought: [],
languages: ["en"],
preferredTools: [],
availability: "MINIMAL", //allAvailabilities[0],
timezoneOffsets: ["1"] // ["UTC+0"] as TimezoneOffset[],
availability: "UNSURE",
timezoneOffsets: ["1"],
}

export const MyPostWrapper: React.FC = () => {
Expand Down

0 comments on commit d2d4bd1

Please sign in to comment.