Skip to content

Instantly share code, notes, and snippets.

View landorid's full-sized avatar

Lándori Dávid landorid

View GitHub Profile
import { rest } from 'msw'
import { Priority } from '../types'
export const handlers = [
rest.get(`${process.env.NEXT_PUBLIC_API_URL}records`, (_req, res, ctx) => {
return res(
ctx.json<{ results: any[]; total_result_count: number }>({
results: [
{
id: '4ea72bc8-3a2f-4364-b853-8659969d4792',
@landorid
landorid / MultiSelect.js
Last active December 24, 2022 13:15
MultiSelect with Tailwind, headlessui
import PropTypes from "prop-types";
import { useState, useRef, useEffect, forwardRef } from "react";
import { Listbox, Transition } from "@headlessui/react";
function MultiSelect({ options, label, selected, onChange }) {
const node = useRef();
const [isOpen, setIsOpen] = useState(false);
useEffect(() => {
document.addEventListener("mousedown", handleClick);