Skip to content

Commit

Permalink
Merge pull request #245 from nodefluxio/feat/new-fields
Browse files Browse the repository at this point in the history
[Frontend] Company size field on request form
  • Loading branch information
williammfu authored Jan 19, 2022
2 parents e919741 + 3631139 commit 1873440
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 16 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
### Changed

### Added

- [FRONTEND] Modify analytic icon to use icon.png name instead of analytic thumbnail field
- [FRONTEND] Add company size field on visitor request form
- [BACKEND] Add company size field

### Changed

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

### Changed
Expand All @@ -27,8 +33,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

0 comments on commit 1873440

Please # to comment.