-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fk 4 #23
base: master
Are you sure you want to change the base?
Fk 4 #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix
src/modules/Jobs/jobs.module.js
Outdated
const offerBox = document.createElement('div'); | ||
offerBox.classList.add('jobOffers__offerBox', 'position-relative', 'shadow', 'p-3', 'mb-5', 'bg-light', 'rounded'); | ||
const offerHeader = document.createElement('h4'); | ||
offerHeader.classList.add('fs-4') | ||
const offerCompanyName = document.createElement('p'); | ||
const offerLocalization = document.createElement('p'); | ||
offerLocalization.classList.add('fw-light') | ||
const offerSalary = document.createElement('span'); | ||
offerSalary.classList.add('fw-light') | ||
const button = document.createElement('a'); | ||
button.setAttribute('href', job.redirect_url) | ||
button.setAttribute('target', '_blank') | ||
button.classList.add('jobOffers__offerBox--button', 'position-absolute', 'bottom-0', 'start-50', 'translate-middle-x') | ||
button.innerText = 'Show more!'; | ||
let minSalary = job.salary_min ? job.salary_min : 'unknow'; | ||
let maxSalary = job.salary_max ? job.salary_max : 'unknow'; | ||
|
||
offerHeader.innerText = job.title ? job.title : 'No title for this role'; | ||
offerCompanyName.innerText = job.company.display_name ? job.company.display_name : null; | ||
offerLocalization.innerText = job.location.display_name ? job.location.display_name : 'Location unknown'; | ||
offerSalary.innerText = `min. salary: ${minSalary} || max. salary: ${maxSalary}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put this all in separate methods like:
const offerHeader = _createOfferHeader()
const offerBox = _createOfferBox()
...
@pdybowski done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update
|
||
|
||
_renderContent(data) { | ||
const containerWithJobOffers = document.createElement('div'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have createElement util to create elements
this.APP_ID = '07300533'; | ||
this.APP_KEY = 'fadda830981b47b9ef3e023f82b349ca'; | ||
this.URL = `https://api.adzuna.com/v1/api/jobs/pl/search/1?app_id=${this.APP_ID}&app_key=${this.APP_KEY}`; | ||
this.fetchedData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this here?
export class Jobs { | ||
constructor() { | ||
this.viewElement = document.querySelector('#main'); | ||
this.APP_ID = '07300533'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these fields should be taken from envirnoment file
fetch(this.URL) | ||
.then(response => response.json()) | ||
.then(data => this._renderContent(data.results)) | ||
.catch(error => this.fetchError = error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use Notification class to show errors
Created Jobs module with list of job offers