feat: initialize Vue component library and aligned documentation
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { Button, Card, Input, Switch } from "@heroui-vue/components";
|
||||
const dark = ref(false),
|
||||
notifications = ref(true),
|
||||
name = ref("设计团队"),
|
||||
saved = ref(false),
|
||||
count = ref(0);
|
||||
function save() {
|
||||
saved.value = true;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="lab" :data-theme="dark ? 'dark' : 'light'">
|
||||
<header>
|
||||
<a class="wordmark" href="#">
|
||||
hero
|
||||
<span>ui</span>
|
||||
<small>Vue</small>
|
||||
</a>
|
||||
<nav>
|
||||
<a href="#components">组件预览</a>
|
||||
<a href="#start">开始使用</a>
|
||||
</nav>
|
||||
<label class="theme">
|
||||
深色模式
|
||||
<Switch v-model:checked="dark" aria-label="深色模式" />
|
||||
</label>
|
||||
</header>
|
||||
<main>
|
||||
<section class="intro">
|
||||
<p class="release">Vue 3 组件库 · 开发预览</p>
|
||||
<h1>
|
||||
熟悉的设计,
|
||||
<br />
|
||||
自然的 Vue 体验。
|
||||
</h1>
|
||||
<p class="lead">
|
||||
从一颗按钮开始,让每一个细节都有章可循。
|
||||
<br />
|
||||
在这里试试第一批组件。
|
||||
</p>
|
||||
<a class="text-link" href="#components">探索组件 ↓</a>
|
||||
</section>
|
||||
<section id="components" class="workbench">
|
||||
<div class="section-title">
|
||||
<h2>组件实验室</h2>
|
||||
<span>4 个组件 · 起步阶段</span>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<Card class="button-demo">
|
||||
<div class="demo-title">
|
||||
<h3>Button</h3>
|
||||
<span>动作与反馈</span>
|
||||
</div>
|
||||
<div class="samples">
|
||||
<Button @click="count++">
|
||||
点击试试
|
||||
<span aria-live="polite">{{ count }}</span>
|
||||
</Button>
|
||||
<Button variant="secondary">次要操作</Button>
|
||||
<Button variant="outline">描边按钮</Button>
|
||||
<Button variant="ghost">轻量操作</Button>
|
||||
<Button variant="danger">危险操作</Button>
|
||||
<Button disabled>不可用</Button>
|
||||
</div>
|
||||
<p class="caption">圆角、尺寸、状态,保持一致的触感。</p>
|
||||
</Card>
|
||||
<Card>
|
||||
<div class="demo-title">
|
||||
<h3>工作区设置</h3>
|
||||
<span>Input + Switch</span>
|
||||
</div>
|
||||
<form @submit.prevent="save">
|
||||
<label class="field">
|
||||
工作区名称
|
||||
<Input
|
||||
v-model="name"
|
||||
name="workspace"
|
||||
required
|
||||
@input="saved = false"
|
||||
/>
|
||||
</label>
|
||||
<div class="setting">
|
||||
<div>
|
||||
<label for="notifications">活动通知</label>
|
||||
<p>接收工作区的重要更新</p>
|
||||
</div>
|
||||
<Switch
|
||||
id="notifications"
|
||||
v-model:checked="notifications"
|
||||
name="notifications"
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" full-width>保存设置</Button>
|
||||
<p class="feedback" role="status">
|
||||
{{
|
||||
saved
|
||||
? `已保存「${name}」的设置`
|
||||
: "修改后点击保存,试试双向绑定。"
|
||||
}}
|
||||
</p>
|
||||
</form>
|
||||
</Card>
|
||||
<Card variant="secondary" class="card-demo">
|
||||
<div class="demo-title">
|
||||
<h3>Card</h3>
|
||||
<span>内容的容器</span>
|
||||
</div>
|
||||
<div class="swatches">
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
</div>
|
||||
<h4>
|
||||
为你的下一次创作
|
||||
<br />
|
||||
留一块画布。
|
||||
</h4>
|
||||
<p>主题变量与组件样式独立维护,让定制从容一点。</p>
|
||||
<Button variant="outline" @click="dark = !dark">切换主题</Button>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
<section id="start" class="start">
|
||||
<div>
|
||||
<h2>从这里开始</h2>
|
||||
<p>本地开发预览,组件仍在持续完善。</p>
|
||||
</div>
|
||||
<code>
|
||||
pnpm install
|
||||
<br />
|
||||
pnpm dev
|
||||
</code>
|
||||
</section>
|
||||
<footer>
|
||||
<span>HeroUI Vue · 独立社区实现</span>
|
||||
<span>以 HeroUI v3 为设计参考</span>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,4 @@
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import "./style.css";
|
||||
createApp(App).mount("#app");
|
||||
@@ -0,0 +1,295 @@
|
||||
@import "tailwindcss";
|
||||
@import "../../../packages/styles/dist/styles.css";
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
|
||||
}
|
||||
button,
|
||||
input {
|
||||
font: inherit;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.lab {
|
||||
min-height: 100vh;
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
transition:
|
||||
background 0.2s,
|
||||
color 0.2s;
|
||||
}
|
||||
header {
|
||||
max-width: 1240px;
|
||||
margin: auto;
|
||||
padding: 28px 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.wordmark {
|
||||
font-weight: 800;
|
||||
font-size: 26px;
|
||||
letter-spacing: -1.4px;
|
||||
}
|
||||
.wordmark span {
|
||||
color: var(--accent);
|
||||
}
|
||||
.wordmark small {
|
||||
font-size: 12px;
|
||||
letter-spacing: 0;
|
||||
font-weight: 600;
|
||||
padding: 4px 8px;
|
||||
border-radius: 6px;
|
||||
background: var(--default);
|
||||
margin-left: 8px;
|
||||
}
|
||||
nav {
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.theme {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
main {
|
||||
max-width: 1240px;
|
||||
margin: auto;
|
||||
padding: 0 48px;
|
||||
}
|
||||
.intro {
|
||||
padding: 70px 0 64px;
|
||||
}
|
||||
.release {
|
||||
font-size: 14px;
|
||||
color: var(--muted);
|
||||
margin: 0 0 22px;
|
||||
}
|
||||
h1 {
|
||||
font-size: clamp(40px, 5.4vw, 68px);
|
||||
font-weight: 650;
|
||||
line-height: 1.18;
|
||||
letter-spacing: -2.5px;
|
||||
margin: 0 0 22px;
|
||||
}
|
||||
.lead {
|
||||
font-size: 17px;
|
||||
line-height: 1.9;
|
||||
color: var(--muted);
|
||||
}
|
||||
.text-link {
|
||||
display: inline-block;
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.section-title h2,
|
||||
.start h2 {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.6px;
|
||||
}
|
||||
.section-title span,
|
||||
.demo-title span {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1.1fr 1fr 0.9fr;
|
||||
gap: 18px;
|
||||
}
|
||||
.demo-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
.demo-title h3 {
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
margin: 0;
|
||||
}
|
||||
.samples {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
.caption {
|
||||
font-size: 12px;
|
||||
line-height: 1.8;
|
||||
color: var(--muted);
|
||||
margin: 30px 0 0;
|
||||
}
|
||||
.field {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.setting {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 24px 0;
|
||||
}
|
||||
.setting label {
|
||||
font-size: 14px;
|
||||
}
|
||||
.setting p {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
margin: 6px 0 0;
|
||||
}
|
||||
.feedback {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
min-height: 32px;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.swatches {
|
||||
display: flex;
|
||||
margin: 8px 0 26px;
|
||||
}
|
||||
.swatches i {
|
||||
display: block;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid var(--default);
|
||||
margin-right: -9px;
|
||||
background: #006fee;
|
||||
}
|
||||
.swatches i:nth-child(2) {
|
||||
background: #86b8ff;
|
||||
}
|
||||
.swatches i:nth-child(3) {
|
||||
background: #bba7f7;
|
||||
}
|
||||
.swatches i:nth-child(4) {
|
||||
background: #f4b0c7;
|
||||
}
|
||||
.card-demo h4 {
|
||||
font-size: 24px;
|
||||
line-height: 1.4;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.7px;
|
||||
margin: 0 0 14px;
|
||||
}
|
||||
.card-demo p {
|
||||
font-size: 13px;
|
||||
line-height: 1.8;
|
||||
color: var(--muted);
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.start {
|
||||
margin-top: 56px;
|
||||
padding: 30px 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 1px solid var(--border);
|
||||
gap: 24px;
|
||||
}
|
||||
.start h2 {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
.start p {
|
||||
font-size: 14px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.start code {
|
||||
min-width: 280px;
|
||||
background: var(--default);
|
||||
border-radius: 12px;
|
||||
padding: 20px 26px;
|
||||
font-size: 13px;
|
||||
line-height: 2;
|
||||
}
|
||||
footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
padding: 24px 0 30px;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
@media (max-width: 1000px) {
|
||||
.grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.card-demo {
|
||||
grid-column: 1/-1;
|
||||
}
|
||||
.card-demo h4 br {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
header {
|
||||
padding: 20px 22px;
|
||||
}
|
||||
nav {
|
||||
display: none;
|
||||
}
|
||||
.theme {
|
||||
font-size: 12px;
|
||||
}
|
||||
main {
|
||||
padding: 0 22px;
|
||||
}
|
||||
.intro {
|
||||
padding: 50px 0;
|
||||
}
|
||||
h1 {
|
||||
letter-spacing: -1.5px;
|
||||
}
|
||||
.grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.section-title span {
|
||||
font-size: 11px;
|
||||
}
|
||||
.start {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
.start code {
|
||||
min-width: 0;
|
||||
}
|
||||
footer {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
.lab {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user