-
Notifications
You must be signed in to change notification settings - Fork 6
rqa5hb Recruitment Form #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sashco-m
wants to merge
55
commits into
main
Choose a base branch
from
rqa5hb_implement_recruitment_form
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 51 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
645f711
Created recruitment application form
LavanSumanan 53ff3c1
Started moving CMS components over
williamhpark 3d794de
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan 37af4a6
Updated radio button
LavanSumanan deb4bb9
Created FileUpload component
LavanSumanan 3952dcd
Transferred code from the Recruitment form page to component
williamhpark a5dd8f2
Fixed styling for components in the recruitment form
LavanSumanan 508c2db
Implemented majority of recruitment form hook functionality
williamhpark 7887b09
Resolved merge conflicts with previous commit
williamhpark 4470f59
Created recruitment application form
LavanSumanan 89975e0
Started moving CMS components over
williamhpark cd99fcb
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan 61de347
Updated radio button
LavanSumanan ef43350
Created FileUpload component
LavanSumanan 0df6239
Transferred code from the Recruitment form page to component
williamhpark 1da8103
Implemented majority of recruitment form hook functionality
williamhpark 9a45b32
Fixed styling for components in the recruitment form
LavanSumanan 9641ff7
Fix rebase issues
LavanSumanan 750fff0
Merge branch 'CU-rt3ce6_Implement-Frontend-For-Form_Lavan-Aidan-Suman…
LavanSumanan 9ae2fb4
Created recruitment application form
LavanSumanan 04cd651
Started moving CMS components over
williamhpark 4033c86
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan c9a5bb5
Updated radio button
LavanSumanan ab714c2
Created FileUpload component
LavanSumanan 7c13976
Transferred code from the Recruitment form page to component
williamhpark 9890e66
Implemented majority of recruitment form hook functionality
williamhpark 50443f5
Fixed styling for components in the recruitment form
LavanSumanan b2ccfdf
Fix rebase issues
LavanSumanan ef71550
Created recruitment application form
LavanSumanan a2b45d2
Started moving CMS components over
williamhpark e308361
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan 47bf317
Updated radio button
LavanSumanan 2185640
Created FileUpload component
LavanSumanan 26ffda1
Transferred code from the Recruitment form page to component
williamhpark 4ac46d7
Implemented majority of recruitment form hook functionality
williamhpark 352691a
Fixed styling for components in the recruitment form
LavanSumanan 3165a63
rebased off master
sashco-m 61bdeca
merge
sashco-m 27fc185
missed
sashco-m b9ec218
remove old componenets
sashco-m 87ec602
passing job info to application page working
sashco-m b008ff7
fix file upload on FE
sashco-m cc37bf3
make dropdownlist show selected value
sashco-m edf17fd
fix broken dropdown lists
sashco-m 8b8726b
added server object, make api call TODO
sashco-m f94d9b3
uploaded file added to state
sashco-m 4cb0135
resume upload working, TODO fix verification failing on application c…
sashco-m de85eed
application working
sashco-m d15ba7a
fix recruitment form styling
sashco-m 7214b96
remove commented code
sashco-m 48afd9f
Add loading spinner on submit
sashco-m 9779892
remove console logs
sashco-m 4be2edc
remove comment
sashco-m d8c0724
merge conflict with master
sashco-m f9002dd
remove unused import
sashco-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| declare module 'recruitment-form' { | ||
| export interface RecruitmentForm { | ||
| postingId: number; | ||
| firstName: string; | ||
| lastName: string; | ||
| emailAddress: string; | ||
| term: string; | ||
| termType: string; | ||
| program: string; | ||
| inPerson: boolean; | ||
| whyJoin: string; | ||
| technicalQ: string; | ||
| additionalInfo: string; | ||
| resumeLink: string; | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { Server } from "./server" | ||
| import { AxiosResponse } from 'axios'; | ||
|
|
||
| const upload = (server:Server) => | ||
| (formData:FormData):Promise<AxiosResponse<string>> => | ||
| server.post('/api/upload/resume', | ||
| formData, { | ||
| headers: { | ||
| 'Content-Type':'multipart/form-data' | ||
| } | ||
| } | ||
| ) | ||
|
|
||
| const apply = (server: Server) => | ||
| (body: Object):Promise<AxiosResponse<string>> => | ||
| server.post('/api/applications', body) | ||
|
|
||
| export default (server:Server) => ({ | ||
| upload: upload(server), | ||
| apply: apply(server) | ||
| }) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| import newsletter from './newsletter'; | ||
| import postings from './postings'; | ||
| import server from './server'; | ||
| import server, { serverDashboard } from './server'; | ||
| import sponsors from './sponsors'; | ||
| import teams from './teams'; | ||
| import application from './application' | ||
|
|
||
| export default { | ||
| postings: postings(server), | ||
| teams: teams(server), | ||
| sponsors: sponsors(server), | ||
| newsletter: newsletter(server) | ||
| newsletter: newsletter(server), | ||
| application: application(serverDashboard) | ||
| }; |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { Server } from 'server'; | ||
| import { AxiosResponse } from 'axios'; | ||
| import { RecruitmentForm } from 'recruitment-form'; | ||
|
|
||
| const getRecruitmentForm = (server: Server) => (): Promise<AxiosResponse<RecruitmentForm>> => server.get(`/api/recruitment`); | ||
|
|
||
|
|
||
| export default (server: Server) => ({ | ||
| getRecruitmentForm: getRecruitmentForm(server), | ||
| }); |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| import React, { useMemo, useState, useCallback, FC } from 'react'; | ||
| import styled, { css } from 'styled-components'; | ||
|
|
||
| import ListOpenSvg from './assets/list-open.svg'; | ||
| import ListClosedSvg from './assets/list-closed.svg'; | ||
| import UnstyledListItem from './ListItem'; | ||
|
|
||
| interface DropDownListProps { | ||
| className?: string; | ||
| items: string[]; | ||
| title: string; | ||
| handleClickItem: (value: string) => void; | ||
| value: string; | ||
| valid: boolean | null; | ||
| required: boolean; | ||
| } | ||
|
|
||
| const ListItem = styled(UnstyledListItem)``; | ||
|
|
||
| const ListOpenIcon = styled.img.attrs({ | ||
| src: ListOpenSvg, | ||
| })``; | ||
|
|
||
| const ListClosedIcon = styled.img.attrs({ | ||
| src: ListClosedSvg, | ||
| })``; | ||
|
|
||
| const Container = styled(({ valid, required, ...props }) => <div {...props} />)` | ||
| overflow: visible; | ||
| z-index: 10; | ||
| ${'' /** Hides the top of the list under the List name container */} | ||
| background-color: #fff; | ||
| width: 100%; | ||
| border: 1px solid #c4c4c4; | ||
| border-radius: 5px; | ||
| border: 1px solid | ||
| ${({ valid, required }): string => | ||
| valid === false && required === true ? 'red' : '#c4c4c4'}; | ||
| `; | ||
|
|
||
| const ListNameContainer = styled.div` | ||
| border-radius: 10px; | ||
| background-color: #fff; | ||
|
|
||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| padding: 16px; | ||
|
|
||
| cursor: pointer; | ||
| `; | ||
|
|
||
| const TitleText = styled.div` | ||
| font: 14px IBM Plex Sans; | ||
| color: #00000080; | ||
| `; | ||
|
|
||
| // Good practice to not pass props like "open" to a root element | ||
| const List = styled(({ open, ...props }) => <ul {...props} />)` | ||
| border-radius: 5px; | ||
|
|
||
| margin-top: -20px; | ||
| padding-top: 8px; | ||
| position: relative; | ||
| width: calc(100% - 10px); | ||
| margin-left: 6px; | ||
| padding-inline-start: 0; | ||
|
|
||
| ${ | ||
| '' /* Cannot Use Transitions with "height: auto", so this calculates the height of the list based on the number of children */ | ||
| } | ||
| ${'' /* ${({ open, children }) => (open ? css` */} | ||
| ${({ open }) => | ||
| open | ||
| ? css` | ||
| ${ | ||
| '' /* height: calc(37px * ${Children.toArray(children).length} ); */ | ||
| } | ||
| ${ | ||
| '' /* This does not transition, but the above does not work well with text wrapping */ | ||
| } | ||
| ${'' /* TODO: This needs to get relooked at when I have more time */} | ||
| height: max-content; | ||
| ` | ||
| : css` | ||
| height: 0px; | ||
| `} | ||
| overflow-y: hidden; | ||
|
|
||
| transition: height 0.15s; | ||
| `; | ||
|
|
||
| const DropDownList: FC<DropDownListProps> = ({ | ||
| className /* Allows for external styles to be applied to the component using | ||
| the styled components library | ||
| className prop needs to be passed to the parent JSX element */, | ||
| items /* an Array of items to be displayed in the selector dropdown */, | ||
| title /* Name of the drop down list */, | ||
| handleClickItem, | ||
| value, | ||
| valid, | ||
| }) => { | ||
| const [open, setOpen] = useState(false); | ||
| const [selected, setSelected] = useState('') | ||
|
|
||
| const handleOpenToggle = useCallback(() => { | ||
| setOpen(!open); | ||
| }, [open, setOpen]); | ||
|
|
||
| const handleClickItem2 = useCallback( | ||
| (value: string) => { | ||
| setSelected(value) | ||
| handleClickItem(value); | ||
| setOpen(!open); | ||
| }, | ||
| [handleClickItem, open, setOpen], | ||
| ); | ||
|
|
||
| const ListStateIcon = useMemo(() => (open ? ListOpenIcon : ListClosedIcon), [ | ||
| open, | ||
| ]); | ||
| const listItems = items.map((item) => ( | ||
| <ListItem text={item} key={item} onClick={handleClickItem2} /> | ||
| )); | ||
|
|
||
| return ( | ||
| <Container> | ||
| <ListNameContainer onClick={handleOpenToggle} className={className}> | ||
| <TitleText>{selected!== '' ? selected : title}</TitleText> | ||
| <ListStateIcon /> | ||
| </ListNameContainer> | ||
| <List open={open}>{listItems}</List> | ||
| </Container> | ||
| ); | ||
| }; | ||
|
|
||
| export default DropDownList; |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import React, { FC } from 'react'; | ||
| import styled from 'styled-components'; | ||
|
|
||
| interface ListItemProps { | ||
| className?: string; | ||
| text: string; | ||
| onClick: (value: string) => void; | ||
| } | ||
|
|
||
| const Container = styled.li` | ||
| list-style: none; | ||
| border-top: 0.75px solid rgba(214, 220, 227, 0.5); | ||
| padding-left: 16px; | ||
| padding-right: 16px; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| padding-top: 8px; | ||
| padding-bottom: 8px; | ||
|
|
||
| cursor: pointer; | ||
| `; | ||
|
|
||
| const Text = styled.div` | ||
| font: 14px IBM Plex Sans; | ||
| color: #000; | ||
| `; | ||
|
|
||
| const ListItem: FC<ListItemProps> = ({ className, text, onClick }) => ( | ||
| <Container className={className} onClick={() => onClick(text)}> | ||
| <Text>{text}</Text> | ||
| </Container> | ||
| ); | ||
|
|
||
| export default ListItem; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import DropDownList from './DropDownList' | ||
|
|
||
| export default DropDownList |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| import React, { useState } from 'react'; | ||
| import styled from 'styled-components'; | ||
|
|
||
| /* | ||
| interface FileUploadProps{ | ||
| handleFileUpload: (value: string) => void; | ||
| } | ||
| */ | ||
|
|
||
| const FileUpload = ({ | ||
| name, | ||
| multiple, | ||
| handleFileUpload, | ||
| }: { | ||
| name: string; | ||
| multiple: boolean; | ||
| handleFileUpload: (value:File) => void; | ||
| }) => { | ||
| const FileInput = styled.input` | ||
| opacity: 0; | ||
| position: absolute; | ||
| z-index: -1; | ||
| `; | ||
|
|
||
| const Label = styled.label` | ||
| display: grid; | ||
| padding: 20px 10px; | ||
| cursor: pointer; | ||
| font-family: IBM Plex Sans; | ||
| font-style: normal; | ||
| font-size: 24px; | ||
| line-height: 140%; | ||
| text-align: center; | ||
| color: rgba(0, 0, 0, 0.5); | ||
| width: 100%; | ||
| border: 1.2px dashed #c4c4c4; | ||
| box-sizing: border-box; | ||
| border-radius: 6px; | ||
| background: #ffffff; | ||
| `; | ||
| let [fileName, setFileName] = useState("") | ||
|
|
||
| return ( | ||
| <div> | ||
| <Label htmlFor="file"> | ||
| <span> | ||
| <svg | ||
| width="24" | ||
| height="33" | ||
| viewBox="0 0 24 33" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M9.08325 32.75H14.9166V15.25H23.6666L11.9999 0.666687L0.333252 15.25H9.08325V32.75Z" | ||
| fill="black" | ||
| fillOpacity="0.4" | ||
| /> | ||
| </svg> | ||
| </span> | ||
| <span> | ||
| <svg | ||
| width="60" | ||
| height="27" | ||
| viewBox="0 0 60 27" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M53.3333 20.5H6.66659V0.083313H0.833252V20.5C0.833252 23.7171 3.4495 26.3333 6.66659 26.3333H53.3333C56.5503 26.3333 59.1666 23.7171 59.1666 20.5V0.083313H53.3333V20.5Z" | ||
| fill="black" | ||
| fillOpacity="0.4" | ||
| /> | ||
| </svg> | ||
| </span> | ||
| <p style={{ margin: 0 }}> | ||
| <strong>Choose a file</strong> or drag it here. | ||
| </p> | ||
| </Label> | ||
| <FileInput | ||
| id="file" | ||
| type="file" | ||
| name={name} | ||
| accept={'application/pdf'} | ||
| onChange={(e) => { | ||
| if(e.target.files != null){ | ||
| // update file in state | ||
| handleFileUpload(e.target.files[0]) | ||
| setFileName(e.target.files[0].name) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| multiple={multiple} | ||
| /> | ||
| {fileName && <p>{fileName}</p>} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default FileUpload; | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import FileUpload from "./FileUpload"; | ||
|
|
||
| export default FileUpload; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.