Skip to content

Commit

Permalink
fix: reverting changes on nopetregisredpage, this page should not be …
Browse files Browse the repository at this point in the history
…modified

fix devhatt#26
  • Loading branch information
RafaelLimaC committed Feb 28, 2024
1 parent e93f8d4 commit 8a0f24a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
10 changes: 6 additions & 4 deletions src/components/RangeSlider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ export default function RangeSlider({ minimum = 0, maximum = 100 }) {

containerElement.style.backgroundPositionX = `${parseInt(containerElement.style.backgroundPositionX || 0, 10) - offsetX}px`;

currentValue = mouseX > startX
? Math.min(maximum, currentValue + stepSize)
: Math.max(minimum, currentValue - stepSize);
currentValue =
mouseX > startX
? Math.min(maximum, currentValue + stepSize)
: Math.max(minimum, currentValue - stepSize);

valueElement.textContent = `${currentValue.toFixed(1)} kg`;

Expand All @@ -53,7 +54,8 @@ export default function RangeSlider({ minimum = 0, maximum = 100 }) {

const handleMouseMove = (event) => {
event.preventDefault();
const clientX = event.type === 'touchmove' ? event.touches[0].clientX : event.clientX;
const clientX =
event.type === 'touchmove' ? event.touches[0].clientX : event.clientX;
handleMove(clientX);
};

Expand Down
17 changes: 9 additions & 8 deletions src/home/components/NoPetRegirestedPage/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Component } from 'pet-dex-utilities';
import Button from '../../../components/Button';
import RangeSlider from '../../../components/RangeSlider';
import petUrl from './images/no-pet-regirested-page.png';
import './index.scss';

const html = `
<div data-select="container" class="no-pet-regirested-page" style="width: 100%;">
<div class="no-pet-regirested-page__content" style="width: 100%;"></div>
<div data-select="container" class="no-pet-regirested-page">
<div class="no-pet-regirested-page__content">
<div class="no-pet-regirested-page__description">
<h1 class="no-pet-regirested-page__title">Você ainda não tem nenhum pet cadastrado</h1>
<p class="no-pet-regirested-page__hint">Crie o perfil do seu pet e deixe o nosso site com o focinho do seu filhote!</p>
</div>
<img class="no-pet-regirested-page__image" src="${petUrl}" alt="dog in an smart phone" />
</div>
</div>;
`;

Expand All @@ -23,11 +29,6 @@ export default function NoPetRegirestedPage() {
.get('button')
.classList.add('no-pet-regirested-page__button');
this.button.mount($container);

const rangeSlider = new RangeSlider(0, 100);
const contentElement = $container.querySelector('.no-pet-regirested-page__content');

rangeSlider.mount(contentElement);
}

NoPetRegirestedPage.prototype = Object.assign(
Expand Down

0 comments on commit 8a0f24a

Please sign in to comment.