-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat(more-info): adding question card and optional observation input #43
Changes from all commits
6a376f9
2189b50
5723c64
b640347
3674aa8
0fec67b
3747d51
eba66d6
ef5c007
2e44d71
75643ef
6414833
5b00c96
3461194
342cb86
8711ea9
7591a6a
e014c4f
241f491
e08618e
e86e08a
3d0dcfe
5aeaaa4
b6a088a
38d4ed0
1e3be19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import './index.scss'; | ||
|
||
import { Component } from 'pet-dex-utilities'; | ||
import InputText from '../TextInput/index'; | ||
|
||
const mockVaccines = [ | ||
{ | ||
year: 2023, | ||
vaccine: 'Antirrábica', | ||
date: '11-02-2023', | ||
doctor: 'Felipa', | ||
}, | ||
{ | ||
year: 2023, | ||
vaccine: 'Raiva', | ||
date: '11-02-2023', | ||
doctor: 'Felipa', | ||
}, | ||
{ | ||
year: 2023, | ||
vaccine: 'Leptospirose', | ||
date: '12-03-2023', | ||
doctor: 'Felipa', | ||
}, | ||
{ | ||
year: 2023, | ||
vaccine: 'Bordetella', | ||
date: '15-04-2023', | ||
doctor: 'Felipa', | ||
}, | ||
{ | ||
year: 2023, | ||
vaccine: 'Giardia', | ||
date: '06-10-2023', | ||
doctor: 'Felipa', | ||
}, | ||
]; | ||
|
||
const html = ` | ||
<div class="more-info-container"> | ||
<div class="more-info-header"> | ||
<h3 class="more-info-header__title">Conte-nos um pouco mais do seu animal</h3> | ||
<h4 class="more-info-header__sub-title">Seu pet já foi vacinado? Conta pra gente que mês ou ano que você costuma comemorar o aniversário dele!</h4> | ||
</div> | ||
<div class="more-info-card"> | ||
<div class="more-info-card__description"> | ||
<img src="../components/more-info/assets/stethoscope.svg" alt="stethoscope" class="more-info-card__description__icon"> | ||
<h3 class="more-info-card__description__title">O seu pet amigo foi castrado?</h3> | ||
</div> | ||
<div class="more-info-card__input-group"> | ||
<div class="more-info-card__input-group__checkbox-group"> | ||
<input type="radio" id="castrado_false" name="castrado"> | ||
<label class="label-check-radios" for="castrado_false"> | ||
<span class="checkmark"></span>Não</label> | ||
</div> | ||
<div class="more-info-card__input-group__checkbox-group"> | ||
<input type="radio" id="castrado_true" name="castrado"> | ||
<label class="label-check-radios" for="castrado_true"> | ||
<span class="checkmark"></span>Sim</label> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="more-info-card"> | ||
<div class="more-info-card__description"> | ||
<img src="../components/more-info/assets/shield.svg" alt="shield" class="more-info-card__description__icon"> | ||
<h3 class="more-info-card__description__title">Cuidados especiais</h3> | ||
</div> | ||
<div class="more-info-card__input-group"> | ||
<div class="more-info-card__input-group__checkbox-group"> | ||
<input type="radio" id="cuidados_False" name="cuidados"> | ||
<label class="label-check-radios" for="cuidados_False"> | ||
<span class="checkmark"></span>Não</label> | ||
</div> | ||
<div class="more-info-card__input-group__checkbox-group"> | ||
<input type="radio" id="cuidados_true" name="cuidados"> | ||
<label class="label-check-radios" for="cuidados_true"> | ||
<span class="checkmark"></span>Sim</label> | ||
</div> | ||
</div> | ||
<label class="label-cuidado">Escreva o cuidado especial</label> | ||
<div data-select="input_text" class="more-info__card-text-group"> | ||
</div> | ||
</div> | ||
<div class="more-info-card"> | ||
<div class="more-info-card__description"> | ||
<img src="../components/more-info/assets/vaccine.svg" alt="vaccine" class="more-info-card__description__icon"> | ||
<h3 class="more-info-card__description__title">Vacinas</h3> | ||
</div> | ||
<div class="more-info-card__input-group"> | ||
<button class='button_add'> | ||
<img src="../components/more-info/assets/plus.svg" alt="plus" class="more-info-card__description__icon"> | ||
Adicionar | ||
</button> | ||
</div> | ||
</div> | ||
<div data-select="render-vaccines" class="render-vaccines"> | ||
</div> | ||
</div>`; | ||
|
||
export default function CardPet() { | ||
Component.call(this, { html }); | ||
const inputText = new InputText({ | ||
placeholder: 'Escreva o cuidado especial', | ||
variation: 'outlined', | ||
}); | ||
const inputContainer = this.selected.get('input_text'); | ||
|
||
inputText.mount(inputContainer); | ||
|
||
if (!mockVaccines) { | ||
// eslint-disable-next-line prettier/prettier | ||
this.selected.get('render-vaccines').innerText = 'Nenhuma vacina cadastrada.'; | ||
} else { | ||
// eslint-disable-next-line no-inner-declarations | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verificar se ainda rpecisa desse comentário com a atualização da branch |
||
function cardVaccine(year, vaccine, date, doctor) { | ||
const cardVaccineHtml = ` | ||
<p class="vaccines-container__year">${year}</p> | ||
<div class="vaccines-group"> | ||
<p class="vaccines-group__title">${vaccine}</p> | ||
<div class="vaccines-group__date-group"> | ||
<img src="../components/more-info/assets/calendar.svg" alt="calendar" class="vaccines-group__date-group__icon"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Importar imagem da pasta local do seu componente, não da pasta assets |
||
<p class="vaccines-group__date-group__date">${date}</p> | ||
</div> | ||
<p class="vaccines-group__doctor">Dr. ${doctor}</p></div>`; | ||
return cardVaccineHtml; | ||
} | ||
const vaccinesContainer = this.selected.get('render-vaccines'); | ||
const dataVaccines = () => { | ||
//preciso de ajuda para não precisar desabilitar a regra | ||
// eslint-disable-next-line no-restricted-syntax | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Atualizando a branch provavelmente vai resolver |
||
for (const item of mockVaccines) { | ||
//preciso de ajuda para não precisar desabilitar a regra | ||
// eslint-disable-next-line prettier/prettier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Atualizando a branch provavelmente vai resolver |
||
const createCardVaccine = cardVaccine(item.year, item.vaccine, item.date, item.doctor); | ||
const divVaccines = document.createElement('div'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. quando temos no js elementos que são tags, não dados de js, usamos o pattern de usar No caso tambem não é uma boa pratica chamar a variavel com o nome ta tag que ela tem, seria melhor um |
||
divVaccines.classList.add('vaccines-container'); | ||
divVaccines.innerHTML = createCardVaccine; | ||
vaccinesContainer.appendChild(divVaccines); | ||
} | ||
}; | ||
dataVaccines(); | ||
} | ||
} | ||
|
||
CardPet.prototype = Object.assign(CardPet.prototype, Component.prototype); |
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.
Verificar se ainda precisa desse comentario atualizando a branch