Last active
February 14, 2019 04:00
-
-
Save ibare/f70231ded9c380b32034f717b3a9be22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Data, animate, Override, Animatable } from "framer" | |
const data = Data({ | |
plusOpacity: 1, | |
minusOpacity: 0.3, | |
page: 0 | |
}) | |
export const PlusButtonStatus: Override = () => { | |
return { | |
opacity: data.plusOpacity | |
} | |
} | |
export const MinusButtonStatus: Override = () => { | |
return { | |
opacity: data.minusOpacity | |
} | |
} | |
export const QuantityNumber: Override = () => { | |
return { | |
currentPage: data.page | |
} | |
} | |
export const PlusButton: Override = () => { | |
return { | |
onTap() { | |
if (data.page < 4) { | |
data.minusOpacity = 1 | |
data.page = data.page + 1 | |
} | |
if (data.page === 4) { | |
data.plusOpacity = 0.3 | |
} | |
} | |
} | |
} | |
export const MinusButton: Override = () => { | |
return { | |
onTap() { | |
if (data.page > 0) { | |
data.plusOpacity = 1 | |
data.page = data.page - 1 | |
} | |
if (data.page === 0) { | |
data.minusOpacity = 0.3 | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment