feat: add name of the project

This commit is contained in:
omar rashed 2024-11-01 17:48:05 +02:00 committed by James Murdza
parent ebb270911b
commit 9197050ca3
2 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import { useSocket } from "@/context/SocketContext"
import { Button } from "@/components/ui/button"
import { Download } from "lucide-react"
export default function DownloadButton() {
export default function DownloadButton({ name }: { name: string }) {
const { socket } = useSocket()
const handleDownload = async () => {
@ -18,12 +18,13 @@ export default function DownloadButton() {
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'sandbox-files.zip'
a.download = `${name}.zip`
a.click()
window.URL.revokeObjectURL(url)
})
}
return (
<Button variant="outline" onClick={handleDownload}>
<Download className="w-4 h-4 mr-2" />

View File

@ -79,8 +79,7 @@ export default function Navbar({
<Users className="w-4 h-4 mr-2" />
Share
</Button>
<DownloadButton />
</>
<DownloadButton name={sandboxData.name} /></>
) : null}
<ThemeSwitcher />
<UserButton userData={userData} />