1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-26 15:04:18 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/ButtonToggleBeforeAfter.js

27 lines
748 B
JavaScript
Raw Normal View History

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"
2021-05-17 22:22:11 +00:00
import Localization from "../../Localization"
2021-04-30 14:37:28 +00:00
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-17 22:22:11 +00:00
{value ? Localization.timeBefore : Localization.timeAfter}
2021-04-30 14:37:28 +00:00
</Button>
)
}