2021-04-30 14:37:28 +00:00
|
|
|
import React, { useState } from "react"
|
|
|
|
import Style from "./ButtonToggleBeforeAfter.module.css"
|
|
|
|
import classNames from "classnames"
|
|
|
|
import Button from "../base/Button"
|
|
|
|
|
|
|
|
|
|
|
|
export default function ButtonToggleBeforeAfter({ onUpdate, className, ...props }) {
|
|
|
|
const [value, setValue] = useState(false)
|
|
|
|
|
|
|
|
const onButtonClick = () => {
|
|
|
|
onUpdate(!value)
|
|
|
|
setValue(value => !value)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
color={"Grey"}
|
|
|
|
className={classNames(Style.ButtonToggleBeforeAfter, className)}
|
|
|
|
onClick={onButtonClick}
|
|
|
|
{...props}
|
|
|
|
>
|
2021-05-13 16:24:52 +00:00
|
|
|
{value ? "Dopo" : "Prima"}
|
2021-04-30 14:37:28 +00:00
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
}
|