2021-04-19 11:34:13 +10:00
|
|
|
import React from 'react';
|
|
|
|
import { useWaku } from './WakuContext';
|
2021-04-19 13:33:23 +10:00
|
|
|
import { Button } from '@material-ui/core';
|
2021-04-19 11:34:13 +10:00
|
|
|
|
|
|
|
interface Props {
|
2021-04-19 12:55:33 +10:00
|
|
|
message: string
|
2021-04-19 11:34:13 +10:00
|
|
|
}
|
|
|
|
|
2021-04-19 12:55:33 +10:00
|
|
|
const Send = (props: Props) => {
|
2021-04-19 11:34:13 +10:00
|
|
|
const { waku } = useWaku();
|
|
|
|
|
2021-04-19 13:33:23 +10:00
|
|
|
const handleClick = async () => {
|
|
|
|
await waku!.send(props.message);
|
|
|
|
};
|
|
|
|
|
2021-04-19 11:34:13 +10:00
|
|
|
return (
|
2021-04-19 14:54:39 +10:00
|
|
|
<Button variant="contained" color="primary" size="large" onClick={handleClick}>
|
2021-04-19 13:33:23 +10:00
|
|
|
Send
|
|
|
|
</Button>
|
2021-04-19 11:34:13 +10:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Send;
|