Skip to content

Commit

Permalink
fix: type for inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
muritadb committed Oct 3, 2024
1 parent 699a7b8 commit 42c0019
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 14 deletions.
66 changes: 52 additions & 14 deletions src/layouts/pages/CreateAccount/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,66 +33,68 @@ const html = `
export default function CreateAccount() {
Component.call(this, { html, events });

// const $container = this.selected.get('container');
const $uploadImage = this.selected.get('image-container');
const $field = this.selected.get('input-container');

const $footerContainer = this.selected.get('footer-container');

const $password = this.selected.get('link-password');

this.activeCard = null;
this.activeForm = null;

const name = new Field({
label: 'Nome e Sobrenome',
error: 'Informe seu nome',
content: new TextInput({
id: 'name',
placeholder: 'Informe seu nomes',
placeholder: 'Informe seu nome completo',
type: 'text',
}),
});

const phone = new Field({
label: 'Celular',
error: 'Devhat',
content: new TextInput({
id: 'name',
id: 'phone',
placeholder: '(11) 12345-6789',
type: 'number',
}),
});

const dataNascimento = new Field({
label: 'Data de nascimento',
error: 'Informe seu nome',
content: new TextInput({
id: 'name',
id: 'nasc',
placeholder: '13/12/1995',
type: 'date',
}),
});

const local = new Field({
label: 'Local',
error: 'Informe seu celualr',
error: 'Informe seu celular',
content: new TextInput({
id: 'name',
id: 'local',
placeholder: 'Sao Paulo, SP',
type: 'text',
}),
});

const mail = new Field({
label: 'E-mail',
error: 'Informe seu nome',
error: 'Informe seu e-mail',
content: new TextInput({
id: 'name',
id: 'mail',
placeholder: 'dev@devhat.com.br',
type: 'mail',
}),
});

const password = new Field({
label: 'Senha',
error: 'Informe seu nome',
error: 'Informe sua senha',
content: new TextInput({
id: 'name',
id: 'password',
placeholder: '*******',
type: 'password',
}),
Expand All @@ -106,8 +108,17 @@ export default function CreateAccount() {

const $image = new UploadImage({});

name.content.listen('value:change', () => {
if (this.activeForm) this.activeCard.deactivate();

this.emit('select:card', name);
$button.enable();
});

$button.listen('click', () => {
this.emit('submit', { breedSelected: this.breedSelected });
// console.log('submitado', { name, phone, dataNascimento, local, mail, password })

this.emit('submit', { name, phone, dataNascimento, local, mail, password });
});

$image.mount($uploadImage);
Expand All @@ -127,3 +138,30 @@ CreateAccount.prototype = Object.assign(
CreateAccount.prototype,
Component.prototype,
);

// o submit do botao vai ser nesse estilo

// const form = {
// isNeutered: undefined,
// isSpecialCare: undefined,
// specialCareText: '',
// vaccines: undefined,
// };

// const emitForm = () => {
// const neuteredValue = document.forms[0].elements.neutered.value;
// const specialCareValue = document.forms[1].elements.specialCare.value;
// const specialCareText = this.specialCareText.selected.get('textarea').value;

// if (!neuteredValue || !specialCareValue) return;
// if (getBooleanValue(specialCareValue) && !specialCareText) return;

// form.isNeutered = getBooleanValue(neuteredValue);
// form.isSpecialCare = getBooleanValue(specialCareValue);
// form.specialCareText = specialCareText;

// form.vaccines = this.vaccine.listVaccines();
// this.emit('submit', form);
// };

// this.button.listen('click', emitForm);
5 changes: 5 additions & 0 deletions src/layouts/pages/CreateAccount/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@

font-size: fonts.$xl;
}

> p {
color: colors.$gray600;
font-size: fonts.$sm;
}
}

&__content {
Expand Down

0 comments on commit 42c0019

Please sign in to comment.