diff --git a/cashtab/src/components/Common/Switch.js b/cashtab/src/components/Common/Switch.js new file mode 100644 --- /dev/null +++ b/cashtab/src/components/Common/Switch.js @@ -0,0 +1,74 @@ +// Copyright (c) 2024 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +import React from 'react'; +import styled from 'styled-components'; +import PropTypes from 'prop-types'; + +const SwitchLabel = styled.label` + position: relative; + display: inline-block; + width: 50px; + height: 25px; + span { + position: absolute; + cursor: pointer; + background-color: #ccc; + border-radius: 25px; + top: 0; + right: 0; + bottom: 0; + left: 0; + transition: background-color 0.2s ease; + } +`; +const Checkbox = styled.input` + display: none; + :checked { + span { + background-color: #336699; + } + span:before { + transform: translateX(25px); + background-color: #6699cc; + } + } +`; +const SwitchBody = styled.span` + :before { + position: absolute; + content: ''; + left: 2px; + top: 2px; + width: 21px; + height: 21px; + background-color: #aaa; + border-radius: 50%; + transition: transform 0.3s ease; + :checked { + transform: translateX(25px); + background-color: #6699cc; + } + } +`; + +const CustomSwitch = ({ checked, handleToggle }) => { + return ( + + + + + ); +}; + +CustomSwitch.propTypes = { + checked: PropTypes.bool, + handleToggle: PropTypes.func, +}; + +export default CustomSwitch; diff --git a/cashtab/src/components/Send/SendXec.js b/cashtab/src/components/Send/SendXec.js --- a/cashtab/src/components/Send/SendXec.js +++ b/cashtab/src/components/Send/SendXec.js @@ -62,6 +62,7 @@ import { isMobile, getUserLocale } from 'helpers'; import { hasEnoughToken, fiatToSatoshis } from 'wallet'; import { toast } from 'react-toastify'; +import CustomSwitch from 'components/Common/Switch'; const { TextArea } = Input; const TextAreaLabel = styled.div` @@ -173,6 +174,7 @@ nonSlpUtxos, chaintipBlockheight, ); + const [toggled, setToggled] = useState(false); const [isOneToManyXECSend, setIsOneToManyXECSend] = useState(false); const [opReturnMsg, setOpReturnMsg] = useState(false); @@ -803,7 +805,12 @@ Webapp Tx Request )} - +
+ +
{' '} Send to