-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
105 additions
and
6 deletions.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
src/Components/Pages/Visualizer/Graphs/MVT/Components/Form.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React, { useContext, useState } from 'react'; | ||
import { FontVarTitle } from '../../../../../Shared/Title'; | ||
import { Icon } from '../../../../../Shared/Icon'; | ||
import { transactionsIcon } from '../../../../../../Resources/Icons'; | ||
import { ThemeContext } from '../../../../../../Context/theme'; | ||
import { ReplicaButton } from '../../../../../Shared/Buttons'; | ||
|
||
const Form = () => { | ||
const { theme } = useContext(ThemeContext); | ||
|
||
const [formData, setFormData] = useState({ | ||
formKey: '', | ||
value: '' | ||
}); | ||
|
||
const handleChange = (e) => { | ||
setFormData({ | ||
...formData, | ||
[e.target.name]: e.target.value | ||
}); | ||
}; | ||
|
||
const submitGet = () => { | ||
// ! CALL GET API HERE | ||
console.log('GET', formData.formKey); | ||
setFormData({ | ||
formKey: '', | ||
value: '' | ||
}); | ||
}; | ||
|
||
const submitCommit = () => { | ||
// ! CALL COMMIT API HERE | ||
console.log('COMMIT', formData); | ||
setFormData({ | ||
formKey: '', | ||
value: '' | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className='mt-2 rounded-md w-550p py-4 px-2 border-3p border-solid border-gray-700 dark:border-gray-50 flex flex-col gap-y-6 bg-blue-10 dark:bg-blue-450'> | ||
<div className="flex items-center justify-center gap-x-2"> | ||
<Icon | ||
fill={theme ? "rgb(209,213,219)" : "black"} | ||
height={'1em'} | ||
path={transactionsIcon} | ||
viewBox={'0 0 448 512'} | ||
/> | ||
<FontVarTitle title={'Send Transaction'} /> | ||
</div> | ||
<div className="flex flex-col gap-y-2"> | ||
<FontVarTitle title={'Key'} fontClass={'text-15p'} /> | ||
<div className='px-8'> | ||
<input | ||
type="text" | ||
id="formKey-input" | ||
className="block w-full p-2 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" | ||
value={formData.formKey} | ||
name='formKey' | ||
onChange={handleChange} | ||
/> | ||
</div> | ||
</div> | ||
<div className="flex flex-col gap-y-2"> | ||
<FontVarTitle title={'Value'} fontClass={'text-15p'} /> | ||
<div className='px-8'> | ||
<input | ||
type="text" | ||
id="value-input" | ||
className="block w-full p-2 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" | ||
value={formData.value} | ||
name='value' | ||
onChange={handleChange} | ||
/> | ||
</div> | ||
</div> | ||
<div className="flex items-center justify-center gap-x-8 my-1"> | ||
<ReplicaButton | ||
title={'Get'} | ||
onClick={submitGet} | ||
faulty={false} | ||
/> | ||
<ReplicaButton | ||
title={'Commit'} | ||
onClick={submitCommit} | ||
faulty={false} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Form; |
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.