feat: move to unocss

This commit is contained in:
Anthony Fu committed 2022-02-17 20:59:24 +08:00
1 parent 31999466ef
commit 44f6b3fd44
17 files changed
+695 -556

No files matched your search

-6
View File
@@ -4,12 +4,6 @@
declare module 'vue' {
export interface GlobalComponents {
CarbonCampsite: typeof import('~icons/carbon/campsite')['default']
CarbonDicomOverlay: typeof import('~icons/carbon/dicom-overlay')['default']
CarbonLanguage: typeof import('~icons/carbon/language')['default']
CarbonLogoGithub: typeof import('~icons/carbon/logo-github')['default']
CarbonMoon: typeof import('~icons/carbon/moon')['default']
CarbonSun: typeof import('~icons/carbon/sun')['default']
Counter: typeof import('./components/Counter.vue')['default']
Footer: typeof import('./components/Footer.vue')['default']
README: typeof import('./components/README.md')['default']
+7 -8
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { isDark, toggleDark } from '~/composables'
import { toggleDark } from '~/composables'
const { t, availableLocales, locale } = useI18n()
@@ -11,26 +11,25 @@ const toggleLocales = () => {
</script>
<template>
<nav class="text-xl mt-6">
<nav text-xl mt-6>
<router-link class="icon-btn mx-2" to="/" :title="t('button.home')">
<carbon-campsite />
<div i-carbon-campsite />
</router-link>
<button class="icon-btn mx-2 !outline-none" :title="t('button.toggle_dark')" @click="toggleDark()">
<carbon-moon v-if="isDark" />
<carbon-sun v-else />
<div i="carbon-sun dark:carbon-moon" />
</button>
<a class="icon-btn mx-2" :title="t('button.toggle_langs')" @click="toggleLocales">
<carbon-language />
<div i-carbon-language />
</a>
<router-link class="icon-btn mx-2" to="/about" :title="t('button.about')">
<carbon-dicom-overlay />
<div i-carbon-dicom-overlay />
</router-link>
<a class="icon-btn mx-2" rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank" title="GitHub">
<carbon-logo-github />
<div i-carbon-logo-github />
</a>
</nav>
</template>
+4 -9
View File
@@ -4,18 +4,13 @@ const { t } = useI18n()
</script>
<template>
<main class="px-4 py-10 text-center text-teal-700 dark:text-gray-200">
<div>
<p class="text-4xl">
<carbon-warning class="inline-block" />
</p>
<main p="x4 y10" text="center teal-700 dark:gray-200">
<div text-4xl>
<div i-carbon-warning inline-block />
</div>
<router-view />
<div>
<button
class="btn m-3 text-sm mt-8"
@click="router.back()"
>
<button btn text-sm m="3 t8" @click="router.back()">
{{ t('button.back') }}
</button>
</div>
+2 -9
View File
@@ -1,18 +1,11 @@
// register vue composition api globally
import { ViteSSG } from 'vite-ssg'
import generatedRoutes from 'virtual:generated-pages'
import { setupLayouts } from 'virtual:generated-layouts'
import App from './App.vue'
// windicss layers
import 'virtual:windi-base.css'
import 'virtual:windi-components.css'
// your custom styles here
import '@unocss/reset/tailwind.css'
import './styles/main.css'
// windicss utilities should be the last style import
import 'virtual:windi-utilities.css'
// windicss devtools support (dev only)
import 'virtual:windi-devtools'
import 'uno.css'
const routes = setupLayouts(generatedRoutes)
+2 -2
View File
@@ -4,11 +4,11 @@ title: About
<div class="text-center">
<!-- You can use Vue components inside markdown -->
<carbon-dicom-overlay class="text-4xl -mb-6 m-auto" />
<div i-carbon-dicom-overlay class="text-4xl -mb-6 m-auto" />
<h3>About</h3>
</div>
[Vitesse](https://github.com/antfu/vitesse) is an opinionated [Vite](https://github.com/vitejs/vite) starter template made by [@antfu](https://github.com/antfu) for mocking apps swiftly. With **file-based routing**, **components auto importing**, **markdown support**, I18n, PWA and uses **WindiCSS** for UI.
[Vitesse](https://github.com/antfu/vitesse) is an opinionated [Vite](https://github.com/vitejs/vite) starter template made by [@antfu](https://github.com/antfu) for mocking apps swiftly. With **file-based routing**, **components auto importing**, **markdown support**, I18n, PWA and uses **UnoCSS** for styling and icons.
```js
// syntax highlighting example
+7 -7
View File
@@ -13,20 +13,20 @@ watchEffect(() => {
<template>
<div>
<p class="text-4xl">
<carbon-pedestrian class="inline-block" />
</p>
<div text-4xl>
<div i-carbon-pedestrian inline-block />
</div>
<p>
{{ t('intro.hi', { name: props.name }) }}
</p>
<p class="text-sm opacity-50">
<p text-sm opacity-50>
<em>{{ t('intro.dynamic-route') }}</em>
</p>
<template v-if="user.otherNames.length">
<p class="text-sm mt-4">
<span class="opacity-75">{{ t('intro.aka') }}:</span>
<p text-sm mt-4>
<span opacity-75>{{ t('intro.aka') }}:</span>
<ul>
<li v-for="otherName in user.otherNames" :key="otherName">
<router-link :to="`/hi/${otherName}`" replace>
@@ -39,7 +39,7 @@ watchEffect(() => {
<div>
<button
class="btn m-3 text-sm mt-6"
btn m="3 t6" text-sm
@click="router.back()"
>
{{ t('button.back') }}
+7 -7
View File
@@ -15,19 +15,19 @@ const { t } = useI18n()
<template>
<div>
<p class="text-4xl">
<carbon-campsite class="inline-block" />
</p>
<div text-4xl>
<div i-carbon-campsite inline-block />
</div>
<p>
<a rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank">
Vitesse
</a>
</p>
<p>
<em class="text-sm opacity-75">{{ t('intro.desc') }}</em>
<em text-sm opacity-75>{{ t('intro.desc') }}</em>
</p>
<div class="py-4" />
<div py-4 />
<input
id="input"
@@ -36,7 +36,7 @@ const { t } = useI18n()
:aria-label="t('intro.whats-your-name')"
type="text"
autocomplete="false"
p="x-4 y-2"
p="x4 y2"
w="250px"
text="center"
bg="transparent"
@@ -48,7 +48,7 @@ const { t } = useI18n()
<div>
<button
class="m-3 text-sm btn"
btn m-3 text-sm
:disabled="!name"
@click="go"
>
+2 -17
View File
@@ -17,27 +17,12 @@ html.dark {
}
#nprogress .bar {
@apply bg-teal-600 opacity-75;
background: rgb(13,148,136);
opacity: 0.75;
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 2px;
}
.btn {
@apply px-4 py-1 rounded inline-block
bg-teal-600 text-white cursor-pointer
hover:bg-teal-700
disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50;
}
.icon-btn {
@apply inline-block cursor-pointer select-none
opacity-75 transition duration-200 ease-in-out
hover:opacity-100 hover:text-teal-600;
font-size: 0.9em;
}
+1 -1
View File
@@ -2,7 +2,7 @@
@import 'prism-theme-vars/base.css';
.prose {
--prism-font-family: 'Input Mono', monospace;
--prism-font-family: 'DM Mono', monospace;
}
.prose img {