Download src/app/(dashboard)/dashboard/endpoint/components/StatusAlert.js from heyeyydss/api9nin: direct link, hf CLI and curl.
- Browser
- Download file 856 Bytes
-
https://huggingface.co/spaces/heyeyydss/api9nin/resolve/main/src/app/(dashboard)/dashboard/endpoint/components/StatusAlert.js
- Command line
-
hf download 'hf://spaces/heyeyydss/api9nin/src/app/(dashboard)/dashboard/endpoint/components/StatusAlert.js'
-
curl -L -o StatusAlert.js 'https://huggingface.co/spaces/heyeyydss/api9nin/resolve/main/src/app/(dashboard)/dashboard/endpoint/components/StatusAlert.js'
856 Bytes
| "use client"; | |
| /** Reusable status alert */ | |
| export default function StatusAlert({ status, className = "" }) { | |
| const renderMessage = (msg) => { | |
| const parts = msg.split(/(https?:\/\/[^\s]+)/g); | |
| return parts.map((part, i) => | |
| /^https?:\/\//.test(part) | |
| ? <a key={i} href={part} target="_blank" rel="noreferrer" className="underline font-medium">{part}</a> | |
| : part | |
| ); | |
| }; | |
| return ( | |
| <div className={`p-2 rounded text-sm ${className} ${status.type === "success" ? "bg-green-500/10 text-green-600 dark:text-green-400" : | |
| status.type === "warning" ? "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400" : | |
| status.type === "info" ? "bg-blue-500/10 text-blue-600 dark:text-blue-400" : | |
| "bg-red-500/10 text-red-600 dark:text-red-400" | |
| }`}> | |
| {renderMessage(status.message)} | |
| </div> | |
| ); | |
| } | |