Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Frontend] Company size field on request form #245

Merged
merged 5 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- [BACKEND] Add company size field

### Changed

### Removed
## [1.2.1 - 13/01/2022]

### Changed
Expand All @@ -25,8 +30,6 @@ All notable changes to this project will be documented in this file.
- [FRONTEND] Change NIST logo to be smaller in larger device
- [FRONTEND] Add Partner Solutions Carousel

### Removed

## [1.1.1 - 30/12/2021]

### Added
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/components/elements/SelectBox/SelectBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const SelectBox = ({
rounded focus:outline-none focus:border-primary-500 font-serif bg-white text-sm sm:text-base"
{...register(id, registerOptions)}
{...otherProps}>
<option value="" disabled selected hidden>
Select option
</option>
{options.map((opt) => (
<option key={opt.value} value={opt.value}>
{opt.name}
Expand Down
43 changes: 30 additions & 13 deletions frontend/app/components/modules/RequestDemoForm/RequestDemoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import { setCookie } from 'nookies'
import { useState } from 'react'
import { SelectBox } from '../../elements/SelectBox/SelectBox'
import data from './industry.json'
import company_data from './company_size.json'
import { Label } from '@/elements/Label/Label'
import { Modal } from '@/elements/Modal/Modal'

const Industries = data.Industries
const { company_size_list } = company_data

type Props = {
onSuccess: () => void
Expand All @@ -26,6 +28,7 @@ type FormData = {
company: string
job_title: string
industry: string
company_size: string
terms_and_conditions: boolean
}

Expand Down Expand Up @@ -150,19 +153,7 @@ export const RequestDemoForm = ({ onSuccess }: Props) => {
}}
errors={errors}
/>
<TextField
id="company"
label="Company"
placeholder="Company name"
type="text"
register={register}
registerOptions={{
required: 'required',
minLength: { value: 5, message: 'minimum length is 5' }
}}
errors={errors}
/>
<div className="flex flex-col md:flex-row w-full justify-between ">
<div className="flex flex-col md:flex-row w-full justify-between">
<div className="md:w-[47%]">
<TextField
id="job_title"
Expand All @@ -177,6 +168,32 @@ export const RequestDemoForm = ({ onSuccess }: Props) => {
errors={errors}
/>
</div>
<div className="md:w-[47%]">
<TextField
id="company"
label="Company Name"
placeholder="Company name"
type="text"
register={register}
registerOptions={{
required: 'required',
minLength: { value: 5, message: 'minimum length is 5' }
}}
errors={errors}
/>
</div>
</div>
<div className="flex flex-col md:flex-row w-full justify-between mb-2">
<div className="md:w-[47%]">
<SelectBox
id="company_size"
label="Company Size"
options={company_size_list}
register={register}
registerOptions={{ required: 'required' }}
errors={errors}
/>
</div>
<div className="md:w-[47%]">
<SelectBox
id="industry"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"company_size_list": [
{ "name": "<50", "value": "<50" },
{ "name": "50-100", "value": "50-100" },
{ "name": "101-500", "value": "101-500" },
{ "name": "501-1000", "value": "501-1000" },
{ "name": ">1000", "value": ">1000" }
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"Industries": [
{"name":"Your company industry", "value":""},
{"name":"Agriculture and Mining", "value":"agriculture_and_mining"},
{"name":"BUMD", "value":"bumd"},
{"name":"BUMN", "value":"bumn"},
Expand Down