Skip to content

Commit

Permalink
chore(sfc-playground): improve buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 16, 2021
1 parent 8055445 commit a276e72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/sfc-playground/src/Header.vue
Expand Up @@ -111,12 +111,18 @@ async function fetchVersions(): Promise<string[]> {
</li>
</ul>
</div>
<button class="toggle-dark" @click="toggleDark">
<button title="Toggle dark mode" class="toggle-dark" @click="toggleDark">
<Sun class="light" />
<Moon class="dark" />
</button>
<button class="share" @click="copyLink"><Share /></button>
<button class="download" @click="downloadProject(store)">
<button title="Copy sharable URL" class="share" @click="copyLink">
<Share />
</button>
<button
title="Download project files"
class="download"
@click="downloadProject(store)"
>
<Download />
</button>
</div>
Expand Down
4 changes: 4 additions & 0 deletions packages/sfc-playground/src/download/download.ts
Expand Up @@ -7,6 +7,10 @@ import config from './template/vite.config.js?raw'
import readme from './template/README.md?raw'

export async function downloadProject(store: any) {
if (!confirm('Download project files?')) {
return
}

const { default: JSZip } = await import('jszip')
const zip = new JSZip()

Expand Down

0 comments on commit a276e72

Please sign in to comment.