Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Allow the user to select recommended options when selecting the current position #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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: 7 additions & 0 deletions src/pages/CreateSalary/CreateSalary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ ion-content {
margin: 0;
}
}
.input-options-list {
margin-top: 10px;
.input-options-list__item {
margin: 0 5px;
cursor: pointer;
}
}
}
}
}
34 changes: 30 additions & 4 deletions src/pages/CreateSalary/CreateSalary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
IonIcon,
IonButtons,
IonBackButton,
IonBadge,
} from '@ionic/react';

import { closeCircleOutline, arrowBack } from 'ionicons/icons';
Expand All @@ -38,11 +39,24 @@ const CreateSalary: React.FC = () => {
weeklyHours: 0,
});
const [technology, setTechnology] = useState('');
const [availablePositions, setAvailablePositions] = useState([
'Developer',
'QA',
]);

const confirmSalary = () => {
console.log(formNewSalary);
};

const onCurrentPositionChange = (value: string) => {
// TODO: update list of available positions based on what the user typed
setAvailablePositions(['Scrum Master', 'CEO']);
setFormNewSalary({
...formNewSalary,
position: value,
});
};

const addNewTechnology = () => {
if (!technology || formNewSalary.technologies.includes(technology)) return;
setFormNewSalary({
Expand Down Expand Up @@ -93,15 +107,27 @@ const CreateSalary: React.FC = () => {
<IonLabel class="label">Current Position</IonLabel>
<IonInput
onIonChange={(e) =>
setFormNewSalary({
...formNewSalary,
position: e.detail.value! as string,
})
onCurrentPositionChange(e.detail.value! as string)
}
type="text"
className="input ion-margin-top"
value={formNewSalary.position}
></IonInput>
<div className="input-options-list">
{availablePositions.map((position: string) => (
<IonBadge
onClick={() =>
setFormNewSalary({
...formNewSalary,
position,
})
}
className="input-options-list__item"
>
{position}
</IonBadge>
))}
</div>
</div>
<div className="input-wrapper">
<IonLabel class="label">Role</IonLabel>
Expand Down