calcom/components/ui/Dropdown.tsx
Alex Johansson f63aa5d550
add linting in CI + fix lint errors (#473)
* run `yarn lint --fix`

* Revert "Revert "add linting to ci""

This reverts commit 0bbbbee4be.

* Fixed some errors

* remove unused code - not sure why this was here?

* assert env var

* more type fixes

* fix typings og gcal callback - needs testing

* rename `md5.ts` to `md5.js`

it is js.

* fix types

* fix types

* fix lint errors

* fix last lint error

Co-authored-by: Alex van Andel <me@alexvanandel.com>
2021-08-19 14:27:01 +02:00

20 lines
428 B
TypeScript

import { useEffect, useState } from "react";
export default function Dropdown(props) {
const [open, setOpen] = useState(false);
useEffect(() => {
document.addEventListener("keyup", (e) => {
if (e.key === "Escape") {
setOpen(false);
}
});
}, [open]);
return (
<div onClick={() => setOpen(!open)} {...props}>
{props.children[0]}
{open && props.children[1]}
</div>
);
}