-
Notifications
You must be signed in to change notification settings - Fork 10
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 #74 from ggggg/UX-vote-loading
Fixes #73
- Loading branch information
Showing
3 changed files
with
153 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import React from "react"; | ||
|
||
interface ErrorAlertProps { | ||
title: string; | ||
text?: string; | ||
onClose: () => void; | ||
enabled: boolean; | ||
buttonText?: string; | ||
} | ||
|
||
export const ErrorAlert = ({ | ||
title, | ||
text, | ||
onClose, | ||
enabled, | ||
buttonText, | ||
}: ErrorAlertProps) => { | ||
return ( | ||
<div | ||
className={`relative z-10 ${enabled ? "" : "hidden"}`} | ||
aria-labelledby="modal-title" | ||
role="dialog" | ||
aria-modal={enabled} | ||
> | ||
{/* Background backdrop, show/hide based on modal state. */} | ||
|
||
{/* Entering: "ease-out duration-300" */} | ||
{/* From: "opacity-0" */} | ||
{/* To: "opacity-100" */} | ||
{/* Leaving: "ease-in duration-200" */} | ||
{/* From: "opacity-100" */} | ||
{/* To: "opacity-0" */} | ||
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div> | ||
|
||
<div className="fixed inset-0 z-10 overflow-y-auto"> | ||
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> | ||
{/* Modal panel, show/hide based on modal state. */} | ||
|
||
{/* Entering: "ease-out duration-300" */} | ||
{/* From: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" */} | ||
{/* To: "opacity-100 translate-y-0 sm:scale-100" */} | ||
{/* Leaving: "ease-in duration-200" */} | ||
{/* From: "opacity-100 translate-y-0 sm:scale-100" */} | ||
{/* To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" */} | ||
<div className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"> | ||
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> | ||
<div className="sm:flex sm:items-start"> | ||
<div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"> | ||
{/* Heroicon name: outline/exclamation-triangle */} | ||
<svg | ||
className="h-6 w-6 text-red-600" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
strokeWidth="1.5" | ||
stroke="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M12 10.5v3.75m-9.303 3.376C1.83 19.126 2.914 21 4.645 21h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 4.88c-.866-1.501-3.032-1.501-3.898 0L2.697 17.626zM12 17.25h.007v.008H12v-.008z" | ||
/> | ||
</svg> | ||
</div> | ||
<div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"> | ||
<h3 | ||
className="text-lg font-medium leading-6 text-gray-900" | ||
id="modal-title" | ||
> | ||
{title} | ||
</h3> | ||
<div className="mt-2"> | ||
<p className="text-sm text-gray-500">{text}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6"> | ||
<button | ||
type="button" | ||
className="inline-flex w-full justify-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm" | ||
onClick={onClose} | ||
> | ||
{buttonText ?? "Close"} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
|
@@ -1937,9 +1937,9 @@ | |
integrity sha512-8MLkBIYQMuhRBQzGN9875bYsOhPnf/0rgXGo66S2FemHkhbn9qtsz9ywV1iCG+vbjigE4WUNVvw37Dx+L0qsPg== | ||
|
||
"@types/node@^12.0.0": | ||
version "12.20.33" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.33.tgz#24927446e8b7669d10abacedd16077359678f436" | ||
integrity sha512-5XmYX2GECSa+CxMYaFsr2mrql71Q4EvHjKS+ox/SiwSdaASMoBIWE6UmZqFO+VX1jIcsYLStI4FFoB6V7FeIYw== | ||
version "12.20.55" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" | ||
integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== | ||
|
||
"@types/normalize-package-data@^2.4.0": | ||
version "2.4.1" | ||
|
@@ -10825,7 +10825,7 @@ [email protected], source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, sourc | |
source-map@^0.5.0, source-map@^0.5.6: | ||
version "0.5.7" | ||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" | ||
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= | ||
integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== | ||
|
||
source-map@^0.7.3, source-map@~0.7.2: | ||
version "0.7.3" | ||
|