-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
279 additions
and
111 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
shamefully-hoist=true | ||
strict-peer-dependencies=false | ||
shell-emulator=true | ||
ignore-workspace-root-check=true |
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,19 @@ | ||
<script lang="ts" setup> | ||
const app = useAppStore() | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col gap-4"> | ||
<textarea | ||
v-model="app.prompt" | ||
placeholder="想要什么样的春联?" | ||
class="w-full rounded-lg p-4 shadow dark:bg-dark-800 outline-none!" | ||
border="~ gray focus:(blue-500)" | ||
maxlength="200" | ||
/> | ||
|
||
<button class="font-zmx w-full btn" text="black 2xl"> | ||
生成! | ||
</button> | ||
</div> | ||
</template> |
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 |
---|---|---|
@@ -1,17 +1,10 @@ | ||
<template> | ||
<div inline-flex cursor-default text-2xl font-300> | ||
<div flex flex-col children:mx-auto> | ||
<img inline-block h-18 w-18 src="/nuxt.svg"> | ||
<span mt--2 text-green5>Nuxt 3</span> | ||
</div> | ||
<div | ||
text="3xl gray4" | ||
m="x-4 y-auto" | ||
i-carbon-add transform transition-all-500 hover:rotate-135 | ||
i-ri-layout-column-line | ||
transform transition-all-500 hover:rotate-135 | ||
/> | ||
<div flex flex-col children:mx-auto> | ||
<img inline-block h-18 w-18 src="/vite.png"> | ||
<span mt--2 text-purple5>Vitesse</span> | ||
</div> | ||
</div> | ||
</template> |
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,94 @@ | ||
<script lang="ts" setup> | ||
import { toPng } from 'html-to-image' | ||
import { downloadDataUrlAsImage } from '@yunlefun/utils' | ||
import { suggestedCoupletsFilename } from '~/config' | ||
async function download() { | ||
const container = document.getElementById('spring-festival-container') | ||
if (!container) | ||
return | ||
// const url = await screenShotToBase64(container) | ||
const url = await toPng(container, { | ||
includeQueryParams: true, | ||
}) | ||
if (url) | ||
downloadDataUrlAsImage(url, suggestedCoupletsFilename) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div id="spring-festival-container" flex="col" class="font-zmx spring-festival-container"> | ||
<div class="font-zmx m-auto bg-#ff0000 p-2" w="50" text="4xl black"> | ||
早上好 | ||
</div> | ||
<div flex class="mt-4 items-center justify-between"> | ||
<div class="spring-festival-couplet"> | ||
春眠不觉晓 | ||
</div> | ||
|
||
<div relative class="spring-festival-fu-container"> | ||
<div class="spring-festival-fu" /> | ||
<!-- not inset-0 for compatibility --> | ||
<span class="fu-char absolute bottom-0 left-0 right-0 top-0"> | ||
福 | ||
</span> | ||
</div> | ||
|
||
<div class="spring-festival-couplet"> | ||
处处闻啼鸟 | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="font-zmx mt-4 flex" text="black" gap="2"> | ||
<button class="w-full btn" text="black" @click="download"> | ||
下载图片 | ||
</button> | ||
<button class="w-full btn" text="black" @click="download"> | ||
拷贝图片 | ||
</button> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss"> | ||
:root { | ||
--ac-fu-font-size: 5rem; | ||
} | ||
.spring-festival-fu { | ||
// square | ||
width: var(--ac-fu-font-size); | ||
height: var(--ac-fu-font-size); | ||
transform: rotate(45deg); | ||
color: black; | ||
background-color: red; | ||
&-container { | ||
font-size: calc(var(--ac-fu-font-size) - 0.5rem); | ||
color: black; | ||
transform: rotate(180deg); | ||
.fu-char { | ||
margin-top: -0.8rem; | ||
} | ||
} | ||
} | ||
.spring-festival-couplet { | ||
font-size: 2.5rem; | ||
color: black; | ||
background-color: red; | ||
writing-mode: vertical-lr; | ||
padding: 1.5rem 0.4rem 1.4rem 0.4rem; | ||
// 文字 gap | ||
letter-spacing: 1rem; | ||
} | ||
</style> |
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,12 @@ | ||
import { acceptHMRUpdate, defineStore } from 'pinia' | ||
|
||
export const useAppStore = defineStore('app', () => { | ||
const prompt = ref('') | ||
|
||
return { | ||
prompt, | ||
} | ||
}) | ||
|
||
if (import.meta.hot) | ||
import.meta.hot.accept(acceptHMRUpdate(useAppStore, import.meta.hot)) |
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 @@ | ||
export const suggestedCoupletsFilename = 'AI 春联.png' |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const appName = 'Vitesse for Nuxt 3' | ||
export const appDescription = 'Vitesse for Nuxt 3' | ||
export const appName = 'AI 春联' | ||
export const appDescription = 'AI 春联生成' |
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
<template> | ||
<main class="px-10 py-20 text-center"> | ||
<main class="p-6 text-center"> | ||
<DarkToggle class="absolute right-4 top-4" /> | ||
|
||
<slot /> | ||
<Footer /> | ||
<div class="mx-auto mt-5 text-center text-sm opacity-25"> | ||
[Default Layout] | ||
</div> | ||
</main> | ||
</template> |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,23 +1,30 @@ | ||
<script setup lang="ts"> | ||
const online = useOnline() | ||
// const online = useOnline() | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<Logos mb-6 /> | ||
<!-- <Logos mb-6 /> --> | ||
|
||
<h2 class="font-zmx my-4" text="4xl"> | ||
AI 春联 | ||
</h2> | ||
|
||
<AiPrompt class="mb-4" /> | ||
|
||
<Suspense> | ||
<ClientOnly> | ||
<PageView v-if="online" /> | ||
<div v-else text-gray:80> | ||
<SpringFestivalCouplets /> | ||
<!-- <PageView v-if="online" /> --> | ||
<!-- <div v-else text-gray:80> | ||
You're offline | ||
</div> | ||
</div> --> | ||
</ClientOnly> | ||
<template #fallback> | ||
<div italic op50> | ||
<span animate-pulse>Loading...</span> | ||
</div> | ||
</template> | ||
</Suspense> | ||
<InputEntry /> | ||
</div> | ||
</template> |
Oops, something went wrong.