convert invite buttons on class page to dropdown

This commit is contained in:
Kent Brockman 2022-07-10 09:02:22 -06:00
parent 6c258225fb
commit 52addc7703

View File

@ -450,8 +450,40 @@ export function ICalButtons(props) {
}); });
}; };
const addToGoogleCalendar = (e) => {
e.preventDefault();
// TODO: fill in URL from clazz properties
window.location = 'https://www.google.com/calendar/render?action=TEMPLATE&text=Title&dates=20190227/20190228'
};
const options = [
{ key: 'email', icon: 'mail outline', text: 'Email ICS Event', value: 'email' },
{ key: 'download', icon: 'download', text: 'Download ICS Event', value: 'download' },
{ key: 'google', icon: 'google', text: 'Add to Google Calendar', value: 'google' },
];
let selectedOption = options[0];
const onClick = (e, data) => {
selectedOption = options.filter(x => x.value === data.value)[0];
console.log(selectedOption);
// TODO set state here
// setState({selectedOption: selectedOption});
// TODO: change the Button onClick handler...based on selected option?
};
return ( return (
<> <Button.Group>
<Button onClick={handleDownload}><Icon name={selectedOption.icon} />{selectedOption.text}</Button>
<Dropdown
className='button icon'
floating
onChange={onClick}
options={options}
trigger={<></>}
/>
</Button.Group>
/*<>
<Button compact onClick={handleDownload}> <Button compact onClick={handleDownload}>
Download Download
</Button> </Button>
@ -463,7 +495,7 @@ export function ICalButtons(props) {
</Button> </Button>
} }
{error && <span>Error.</span>} {error && <span>Error.</span>}
</> </>*/
); );
}; };