Skip to content

Commit

Permalink
chore: add direct listen and fix weithRange
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasGz committed Sep 6, 2024
1 parent c8f9271 commit ba2b04e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from 'pet-dex-utilities';
import UploadImage from '../../../../components/UploadImage';
import SizeSelector from '../../../../components/SizeSelector';
import Button from '../../../../components/Button';
import Button from '~src/components/Button';
import UploadImage from '~src/components/UploadImage';
import SizeSelector from '~src/components/SizeSelector';
import './index.scss';

const events = ['submit'];
Expand Down Expand Up @@ -41,7 +41,14 @@ export default function PetSize() {
});

this.renderComponents();
this.emitSize();
this.getSize();
this.button.listen('click', () => {
this.emit('submit', {
sizeTitle: this.sizeTitle,
weightRange: this.weightRange,
sizeIndex: this.sizeIndex,
});
});
}

PetSize.prototype = Object.assign(PetSize.prototype, Component.prototype, {
Expand All @@ -63,20 +70,10 @@ PetSize.prototype = Object.assign(PetSize.prototype, Component.prototype, {
this.sizeTitle = card.querySelector(
'.container-size-selector__title',
).textContent;
this.weightRange = this.sizeselector
.activeCardInit()
.card.querySelector('.container-size-selector__text').textContent;
this.weightRange = card.querySelector(
'.container-size-selector__text',
).textContent;
this.sizeIndex = index;
});
},
emitSize() {
this.getSize();
this.button.listen('click', () => {
this.emit('submit', {
sizeTitle: this.sizeTitle,
weightRange: this.weightRange,
sizeIndex: this.sizeIndex,
});
});
},
});
File renamed without changes.

0 comments on commit ba2b04e

Please sign in to comment.