Skip to content

Commit

Permalink
feat: 更新样式和项目
Browse files Browse the repository at this point in the history
  • Loading branch information
dxhuii committed Apr 16, 2024
1 parent 7fc1be9 commit d50f10e
Show file tree
Hide file tree
Showing 8 changed files with 3,717 additions and 2,777 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.10.0
v20.12.2
4 changes: 4 additions & 0 deletions constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const appName = '内容清单'
export const appDescription = '内容清单'

export const DEFAULT_FONT_SIZE = '15px'
16 changes: 15 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@
import dxhuii from '@dxhuii/eslint-config'
import antfu from '@antfu/eslint-config'

export default antfu({ react: true, unocss: true, formatters: true }, dxhuii())
export default antfu({vue: true, unocss: true, formatters: true, typescript: true }, dxhuii({}), {

Check failure on line 5 in eslint.config.js

View workflow job for this annotation

GitHub Actions / lint

A space is required after '{'
ignores: [
'dist',
'.umi',
'mock',
'node_modules',
'coverage',
'scripts',
'config',
'.history',
'/lambda/',
'public',
'**/*.json'
]
})
9 changes: 8 additions & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<script setup lang="ts">
import { appName } from '~/constants'
</script>

<template>
<main class="m-auto max-w-3xl px-10 py-20">
<main class="px10 py20">
<slot />
<Footer />
<div class="mx-auto mt5 text-center text-sm opacity-35">
{{ appName }} [<a href="https://cms.im">CMS.IM</a>] @ {{ new Date().getFullYear() }}
</div>
</main>
</template>
31 changes: 17 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"type": "module",
"version": "0.0.0",
"private": true,
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"engines": {
"node": "20.12.2"
},
"scripts": {
"build": "nuxi build",
"dev:pwa": "VITE_PLUGIN_PWA=true nuxi dev",
Expand All @@ -17,21 +20,21 @@
"release": "bumpp"
},
"devDependencies": {
"@antfu/eslint-config": "2.6.1",
"@dxhuii/eslint-config": "^2.0.0",
"@iconify-json/carbon": "^1.1.27",
"@antfu/eslint-config": "2.14.0",
"@dxhuii/eslint-config": "^2.1.0",
"@iconify-json/carbon": "^1.1.31",
"@iconify-json/twemoji": "^1.1.15",
"@nuxtjs/color-mode": "^3.3.2",
"@nuxtjs/color-mode": "^3.4.0",
"@pinia/nuxt": "^0.5.1",
"@unocss/eslint-config": "^0.58.3",
"@unocss/nuxt": "^0.58.3",
"@vite-pwa/nuxt": "^0.4.0",
"@vueuse/nuxt": "^10.7.1",
"bumpp": "^9.2.1",
"eslint": "^8.56.0",
"nuxt": "^3.9.1",
"@unocss/eslint-config": "^0.59.2",
"@unocss/nuxt": "^0.59.3",
"@vite-pwa/nuxt": "^0.6.0",
"@vueuse/nuxt": "^10.9.0",
"bumpp": "^9.4.0",
"eslint": "^9.0.0",
"nuxt": "^3.11.2",
"pinia": "^2.1.7",
"typescript": "^5.3.3",
"vue-tsc": "^1.8.27"
"typescript": "^5.4.5",
"vue-tsc": "^2.0.13"
}
}
120 changes: 68 additions & 52 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,66 +1,82 @@
<script setup lang="ts">
const list = [{
title: '备忘清单',
href: 'https://quickref.cms.im/',
icon: 'i-twemoji:blue-book',
desc: '开发人员分享快速参考备忘清单',
target: '_blank'
},
{
title: 'JS框架对比',
href: 'https://component-party.cms.im/',
icon: 'i-twemoji:party-popper',
desc: 'JavaScript框架语法特性对比',
target: '_blank'
},
{
title: 'IT工具箱',
href: 'https://tools.cms.im/',
icon: 'i-twemoji:toolbox',
desc: '助力开发人员和 IT 工作者',
target: '_blank'
},
{
title: 'NPM下载统计',
href: 'https://npm-stat.link/',
icon: 'i-twemoji-chart-increasing',
desc: '查看使用包的各个版本的NPM下载统计',
target: '_blank'
},
{
title: 'RGB转十六进制',
href: '/rgb2hex',
icon: 'i-twemoji:currency-exchange',
desc: 'RGB颜色值与十六进制颜色码转换工具'
},
{
title: '批量删除微博博文',
href: 'https://github.com/dxhuii/delWeibo',
icon: 'i-twemoji-delivery-truck',
desc: '批量删除新浪微博的小工具',
target: '_blank'
}
]
</script>

<template>
<div>
<h1 text="3xl">
内容清单
</h1>
<div mt-4 text="base gray-500">
收集一些有用的内容
</div>
<h2 class="mt-4 flex items-center">
<span flex-1>项目目录</span>
<div class="ml-2 cursor-pointer op-50 transition-opacity hover:op-100">
<a target="_blank" href="https://github.com/dxhuii">
<div class="i-ri-arrow-right-up-line m-2" />
</a>
<div flex="~ col" items-center>
<h1 text="2xl">
内容清单 <sup text="base" bg-card border-base top--3 border rounded px1 text-3 tracking-0.5 style="">CMS.IM</sup>
</h1>
<div mt-4 text="base gray-500">
收集一些有用的内容
</div>
</div>
<h2 class="mt4 flex">
项目目录
</h2>
<div class="grid grid-cols-1 mt-4 gap-4 sm:grid-cols-2">
<a
class="rounded-md bg-gray-100 px-4 py-3 decoration-none transition-colors dark:bg-gray-50/10 hover:bg-gray-200 dark:hover:bg-gray-50/20"
target="_blank" href="https://quickref.cms.im/"
>
<div class="h-full flex items-center justify-center">
<div flex-1>
<div font-medium leading-relaxed>备忘清单</div>
<div text-sm font-normal op-50>开发人员分享快速参考备忘清单</div>
</div>
<div ml-4 text-4xl op-75>
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
<path d="m21.66 10.44-.98 4.18c-.84 3.61-2.5 5.07-5.62 4.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2 1.17-2.42 3.16-3.07 6.5-2.28l1.67.39c4.19.98 5.47 3.05 4.49 7.23Z" fill="#c9d1d9" />
<path d="M15.06 19.39c-.62.42-1.4.77-2.35 1.08l-1.58.52c-3.97 1.28-6.06.21-7.35-3.76L2.5 13.28c-1.28-3.97-.22-6.07 3.75-7.35l1.58-.52c.41-.13.8-.24 1.17-.31-.3.61-.54 1.35-.74 2.2l-.98 4.19c-.98 4.18.31 6.24 4.48 7.23l1.68.4c.58.14 1.12.23 1.62.27Zm2.43-8.88c-.06 0-.12-.01-.19-.02l-4.85-1.23a.75.75 0 0 1 .37-1.45l4.85 1.23a.748.748 0 0 1-.18 1.47Z" fill="#228e6c" />
<path d="M14.56 13.89c-.06 0-.12-.01-.19-.02l-2.91-.74a.75.75 0 0 1 .37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z" fill="#228e6c" />
</svg>
</div>
</div>
</a>
<a
class="rounded-md bg-gray-100 px-4 py-3 decoration-none transition-colors dark:bg-gray-50/10 hover:bg-gray-200 dark:hover:bg-gray-50/20"
target="_blank" href="https://github.com/dxhuii/delWeibo"
>
<div class="h-full flex items-center justify-center">
<div flex-1>
<div font-medium leading-relaxed>批量删除微博博文</div>
<div text-sm font-normal op-50>批量删除新浪微博的小工具</div>
</div>
<div ml-4 text-4xl op-75>
<div class="i-twemoji-delivery-truck" />
</div>
</div>
</a>
<a
class="rounded-md bg-gray-100 px-4 py-3 decoration-none transition-colors dark:bg-gray-50/10 hover:bg-gray-200 dark:hover:bg-gray-50/20"
target="_blank" href="https://npm-stat.link/"
<div class="grid grid-cols-1 mt4 gap4 sm:grid-cols-2 md:sm:grid-cols-4">
<NuxtLink
v-for="item in list" :key="item.href"
:to="item.href"
class="rounded-md bg-gray-100 px4 py3 decoration-none transition-colors dark:bg-gray-50/10 hover:bg-gray-200 dark:hover:bg-gray-50/20"
:target="item.target"
>
<div class="h-full flex items-center justify-center">
<div flex-1>
<div font-medium leading-relaxed>NPM下载统计</div>
<div text-sm font-normal op-50>查看使用包的各个版本的NPM下载统计</div>
<div font-medium leading-relaxed>
{{ item.title }}
</div>
<div text-sm font-normal op-50>
{{ item.desc }}
</div>
</div>
<div ml-4 text-4xl op-75>
<div class="i-twemoji-chart-increasing" />
<div :class="item.icon" />
</div>
</div>
</a>
</NuxtLink>
</div>
</div>
</template>
74 changes: 74 additions & 0 deletions pages/rgb2hex.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<script setup>
import { appName } from '~/constants'
useHead({
title: `RGB颜色值与十六进制颜色码转换工具 - ${appName}`
})
const r2h = ref({ r: 255, g: 180, b: 0 })
const hex = ref('#ffb400')
const h = ref('#cc00ff')
const rgb = ref([204, 0, 255])
// ------- //
// rgb2hex //
// ------- //
// one liner to convert rgb color (provided as a string) to hex
// const rgb2hex = rgb => `#${rgb.replace(/[^0-9,]/g, "").split(",").map(n => (n|0).toString(16).padStart(2, '0')).join("")}`;
// straight from array
// const rgb2hexArr = rgb => `#${rgb.map(n => (n|0).toString(16).padStart(2, '0')).join("")}`;
// ------- //
// hex2rgb //
// ------- //
// one liner to convert hex color to rgb (as a string)
// const hex2rgb = hex => `rgb(${hex.replace("#", "").match(/../g).map(n => parseInt(n, 16)).join(", ")})`;
// to array
// const hex2rgbArr = hex => hex.replace("#", "").match(/../g).map(n => parseInt(n, 16));
/**
* rgb转16进制
*/
function rgb2hex() {
const { r, g, b } = r2h.value
const rgb = (r << 16) | (g << 8) | b
hex.value = `#${rgb.toString(16).padStart(6, '0')}`
}
// 16进制转rgb
function hex2rgb() {
rgb.value = h.value.replace('#', '').match(/../g).map(n => Number.parseInt(n, 16))
}
</script>

<template>
<div flex="~ col" items-center>
<h1 flex="~">
RGB颜色值转换成十六进制颜色码:<div mr4 inline-block w-10 px4 :style="{ backgroundColor: hex }" />
<input v-model="hex" type="text" w-40 border border-base px2>
</h1>
<div flex="~ col" mt4>
<div flex="~ gap4">
<input v-model="r2h.r" type="number" w-20 border border-base px2>
<input v-model="r2h.g" type="number" w-20 border border-base px2>
<input v-model="r2h.b" type="number" w-20 border border-base px2>
<button flex items-center justify-center rounded-full btn-primary @click="rgb2hex">
转换
</button>
</div>
</div>
<h1 flex="~" mt8>
十六进制颜色码转换成RGB颜色值:<div mr4 inline-block w-10 px4 :style="{ backgroundColor: `rgb(${rgb})` }" />
<input v-model="rgb" type="text" w-40 border border-base px2>
</h1>
<div flex="~ gap4" mt4>
<input v-model="h" type="text" border border-base px2>
<button flex items-center justify-center rounded-full btn-primary @click="hex2rgb">
转换
</button>
</div>
</div>
</template>
Loading

0 comments on commit d50f10e

Please sign in to comment.