-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #525 from theosanderson/layerspecs
Add SVG export!!!!
- Loading branch information
Showing
11 changed files
with
385 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React, { useState, Fragment } from "react"; | ||
import { Dialog, Transition } from "@headlessui/react"; | ||
import { BiCamera } from "react-icons/bi"; | ||
import TaxButton from "./TaxButton"; | ||
|
||
const SnapshotButton = ({ svgFunction, pixelFunction, deckSize }) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
function snapshot(option) { | ||
if (option === "pixels") { | ||
pixelFunction(); | ||
} else if (option === "SVG") { | ||
svgFunction(deckSize); | ||
} | ||
setIsOpen(false); | ||
} | ||
|
||
return ( | ||
<> | ||
<TaxButton onClick={() => setIsOpen(true)} title="Take screenshot"> | ||
<BiCamera className="mx-auto w-5 h-5 inline-block" /> | ||
</TaxButton> | ||
|
||
<Transition.Root show={isOpen} as={Fragment}> | ||
<Dialog | ||
as="div" | ||
static | ||
className="fixed inset-0 z-10 overflow-y-auto" | ||
open={isOpen} | ||
onClose={setIsOpen} | ||
> | ||
<div className="min-h-screen px-4 text-center"> | ||
<Dialog.Overlay className="fixed inset-0 bg-black opacity-30" /> | ||
|
||
<span | ||
className="inline-block h-screen align-middle" | ||
aria-hidden="true" | ||
> | ||
​ | ||
</span> | ||
|
||
<div className="inline-block w-full max-w-md p-6 my-8 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl rounded-2xl"> | ||
<Dialog.Title | ||
as="h3" | ||
className="text-lg font-medium leading-6 text-gray-900" | ||
> | ||
Choose format | ||
</Dialog.Title> | ||
|
||
<div className="mt-4"> | ||
<button | ||
onClick={() => snapshot("SVG")} | ||
className="text-blue-600 hover:text-blue-800" | ||
> | ||
SVG (vector) | ||
</button> | ||
<button | ||
onClick={() => snapshot("pixels")} | ||
className="ml-4 text-blue-600 hover:text-blue-800" | ||
> | ||
PNG | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</Dialog> | ||
</Transition.Root> | ||
</> | ||
); | ||
}; | ||
|
||
export default SnapshotButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const TaxButton = ({ children, onClick, title }) => { | ||
return ( | ||
<button | ||
className=" w-12 h-10 bg-gray-100 p-1 rounded border-gray-300 text-gray-700 opacity-70 hover:opacity-100 mr-1 z-50 mt-auto mb-1 | ||
shadow-md " | ||
onClick={onClick} | ||
title={title} | ||
style={{ | ||
pointerEvents: "auto", | ||
}} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default TaxButton; |
Oops, something went wrong.
dafe7a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
cov2tree – ./
mpx.taxonium.org
taxonomy.taxonium.org
vbigtree.vercel.app
taxonium.org
www.cov2tree.org
taxodium.org
cov2tree.org
www.taxonium.org
www.taxodium.org
visualtreeoflife.taxonium.org
cov2tree-theosanderson.vercel.app
cov2tree-git-master-theosanderson.vercel.app