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

25 lines
743 B
JavaScript

import React, { useContext } from "react"
import Style from "./ButtonToggleBeforeAfter.module.css"
import classNames from "classnames"
import Button from "../base/Button"
import ContextLanguage from "../../contexts/ContextLanguage"
export default function ButtonToggleBeforeAfter({ isBefore, setBefore, className, ...props }) {
const { strings } = useContext(ContextLanguage)
const onButtonClick = () => {
setBefore(a => !a)
}
return (
<Button
color={"Grey"}
className={classNames(Style.ButtonToggleBeforeAfter, className)}
onClick={onButtonClick}
{...props}
>
{isBefore ? strings.timeBefore : strings.timeAfter}
</Button>
)
}