[go: up one dir, main page]

Skip to content

project-trans/SuggestionBox

Repository files navigation

Suggestion box

Suggestion box for Project Trans's website.

Usage

# Or npm, yarn, bun, etc.
pnpm add @project-trans/suggestion-box
pnpm add @iconify-json/octicon -D # Suggestion Box uses octicon.

In your Vue component:

<template>
  <SuggestionBox
    target-url="https://example.com"
    contact-content-placeholder="联系方式占位符"
    text-content-placeholder="文本内容占位符"
    attach-image-button-text="附加图片按钮文案"
    send-button-text="发送按钮文案"
    sending-button-text="发送中按钮文案"
    sent-success-button-text="发送成功按钮文案"
    sent-failed-button-text="发送失败按钮文案"
  />
</template>

<script>
import SuggestionBox from '@project-trans/suggestion-box';
import '@project-trans/suggestion-box/dist/style.css';
</script>

In uno.config.ts:

import { defineConfig, presetUno, presetIcons } from 'unocss';

export default defineConfig({
  // ...
  content: {
    pipeline: {
      include: [
        // Default match pattern of UnoCSS
        /\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
        // Match suggestion-box
        /.*pjts-suggestion-box.*\.js/,
      ],
    },
  },
  presets: [
    // SuggestionBox uses presetUno
    presetUno(),
    // SuggestionBox uses presetIcons
    presetIcons(),
  ],
});

Development

corepack enable

Install dependencies

pnpm install

Start UI development server

pnpm dev

Start Cloudflare Pages Functions development server

pnpm -F server dev