riffusion-app/components/Info.tsx

119 lines
4.5 KiB
TypeScript
Raw Normal View History

2022-11-23 22:46:32 -07:00
import { Dialog, Transition } from "@headlessui/react";
import { Fragment, useState } from "react";
2022-11-24 17:54:00 -07:00
import { FiInfo } from "react-icons/fi";
import styled, { css } from "styled-components";
const ModalContainer = styled.div`
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
`;
export default function Info() {
2022-11-23 22:46:32 -07:00
const [open, setOpen] = useState(false);
2022-11-24 21:58:44 -07:00
var classNameCondition = ""
if (open) {
2022-12-08 17:58:49 -07:00
classNameCondition = "fixed z-20 top-44 right-4 md:top-48 md:right-8 bg-sky-400 w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-white text-2xl hover:bg-sky-500 hover:drop-shadow-2xl"
2022-11-24 21:58:44 -07:00
} else {
2022-12-08 15:20:55 -07:00
classNameCondition = "fixed z-20 top-44 right-4 md:top-48 md:right-8 bg-slate-100 w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-sky-900 text-2xl hover:text-white hover:bg-sky-600 hover:drop-shadow-2xl"
2022-11-24 21:58:44 -07:00
}
return (
<>
<button
2022-11-24 17:54:00 -07:00
title="Info"
className={classNameCondition}
2022-11-23 22:46:32 -07:00
onClick={() => setOpen(true)}
>
2022-11-24 17:54:00 -07:00
<FiInfo />
2022-11-23 22:46:32 -07:00
</button>
<Transition appear show={open} as={Fragment}>
<Dialog
as="div"
2022-12-12 11:28:49 -07:00
className="fixed inset-0 z-20 overflow-y-auto"
onClose={() => setOpen(false)}
>
<div className="min-h-screen px-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<Dialog.Overlay className="fixed inset-0" />
</Transition.Child>
<span
className="inline-block h-screen align-middle"
aria-hidden="true"
>
&#8203;
</span>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<ModalContainer>
<div className="my-8 inline-block w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
<Dialog.Title
as="h1"
className="text-3xl font-medium leading-6 text-gray-900 pb-2"
>
Welcome to Riffusion
</Dialog.Title>
<div className="mt-4">
<p className="text-sm text-gray-500">
2022-12-08 13:40:10 -07:00
Riffusion generates endless new jams from any text prompt. Try typing in your favorite artist or genre, and you'll hear the music gradually transform.<br></br>
<br></br>
The diffusion model first creates images from your prompt, and then converts them into music. Learn more about surfing the latent space of sound below.<br></br>
</p>
</div>
<div className="mt-6">
<button
className="relative inline-flex items-center justify-center p-0.5 mb-2 mr-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-sky-500 group-hover:from-sky-600 group-hover:to-sky-500 hover:text-white"
onClick={() => {
window.open("/about", "_blank");
setOpen(false);
}}
>
<span className="relative px-5 py-2 transition-all ease-in duration-75 bg-white rounded-md group-hover:bg-opacity-0">
Surfing the what?
</span>
</button>
<button
type="button"
className="text-white bg-gradient-to-br from-purple-600 to-sky-500 hover:bg-gradient-to-bl font-medium rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2"
onClick={() => setOpen(false)}
>
Let&apos;s Riff 🎸
</button>
</div>
</div>
</ModalContainer>
</Transition.Child>
</div>
</Dialog>
</Transition>
</>
2022-11-23 22:46:32 -07:00
);
};