import { useCallback, useState } from 'react';
import UIButton from './UIButton';
import UIPressable from './UIPressable';
import UISecondaryBox from './UISecondaryBox';
import UITextInput from './UITextInput';
import useToggle from './useToggle';
function GroupJoiner() {
const [code, setCode] = useState('');
const [joining, setJoining] = useState(false);
const join = useCallback(() => {
if (code) {
console.log('Joining a group with the code', code);
setJoining(true);
setTimeout(() => {
setJoining(false);
}, 500);
}
}, [code]);
const buttonEnabled = code.length > 0 && !joining;
return (
Join Group
Code
{joining ? 'Joining' : 'Join'}
);
}
export default function GroupJoinerLink() {
const [open, toggle] = useToggle(false);
return (
<>
Join Group
{open && (
<>
>
)}
>
);
}