Skip to content

Commit 5a474aa

Browse files
committed
feat(omi-templates): unified color, organized catalog
1 parent 9568564 commit 5a474aa

32 files changed

+280
-447
lines changed

packages/omi-templates/src/components/appear.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export class Appear extends Component {
1818
this.classList.add(item)
1919
this.classList.remove(item)
2020
})
21-
// o-table 和 日历组件的切换时,需要刷新一下
2221
window.refreshDark()
2322
}, 10)
2423
}

packages/omi-templates/src/components/customize-button.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { showCustomize } from './customize.tsx'
22

33
export function CustomizeButton() {
44
return (
5-
<div class="fixed right-0 bottom-0 m-6 bg-gray-300 dark:bg-background dark:text-foreground bg-opacity-40 backdrop-filter h-16 backdrop-blur-md py-2 px-3 rounded-full flex items-center">
5+
<div class="fixed right-0 bottom-0 m-6 bg-zinc-300 dark:bg-background dark:text-foreground bg-opacity-40 backdrop-filter h-16 backdrop-blur-md py-2 px-3 rounded-full flex items-center">
66
<button
7-
class="flex border bg-gray-100 dark:bg-background dark:text-foreground p-2 rounded-full text-gray-600 hover:text-primary"
7+
class="flex border bg-zinc-100 dark:bg-background dark:text-foreground p-2 rounded-full text-zinc-600 hover:text-primary"
88
onClick={(evt) => {
99
evt.stopPropagation()
1010
showCustomize()

packages/omi-templates/src/components/customize.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Customize extends Component {
8383
<div class="flex items-start pt-4 md:pt-0">
8484
<div class="space-y-1 pr-2">
8585
<div class="font-semibold leading-none tracking-tight text-lg dark:text-foreground">自定义</div>
86-
<div class="text-muted-foreground text-gray-600 dark:text-foreground">为你的模板选择一个颜色和样式。</div>
86+
<div class="text-muted-foreground text-zinc-600 dark:text-foreground">为你的模板选择一个颜色和样式。</div>
8787
</div>
8888
</div>
8989
<div class="flex flex-1 flex-col space-y-4 md:space-y-6">

packages/omi-templates/src/components/dark-switch.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export class DarkSwitch extends Component {
1515

1616
render() {
1717
return (
18-
<div class="w-[60px] h-8 bg-gray-300 dark:bg-zinc-400 rounded-[2px] relative">
18+
<div class="w-[60px] h-8 bg-zinc-300 dark:bg-zinc-400 rounded-[2px] relative">
1919
<div
2020
class={classNames('absolute z-0 w-[28px] h-[28px] top-[2px] rounded-[2px] transition-all duration-300', {
2121
'left-[2px] bg-white': !isDark.value,
22-
'left-[30px] bg-gray-500': isDark.value,
22+
'left-[30px] bg-zinc-500': isDark.value,
2323
})}
2424
></div>
2525

@@ -72,7 +72,7 @@ export class DarkSwitch extends Component {
7272
<div
7373
class={classNames('absolute transition-all duration-300 w-[30px] h-[30px] right-0 px-1.5 py-[7px]', {
7474
'text-white': isDark.value,
75-
'text-gray-500 cursor-pointer': !isDark.value,
75+
'text-zinc-500 cursor-pointer': !isDark.value,
7676
})}
7777
onClick={this.onDarkClick}
7878
>

packages/omi-templates/src/components/fallback.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const fallback = (
2-
<div class="flex items-center justify-center bg-gray-100" style="height:calc(100vh - 349px)">
2+
<div class="flex items-center justify-center bg-zinc-100" style="height:calc(100vh - 349px)">
33
<div class="p-8 text-center">
44
<div class="mb-4 text-primary">
55
<svg data-v-452ecc15="" xmlns="http://www.w3.org/2000/svg" width="200" height="140" fill="none">
@@ -30,15 +30,15 @@ export const fallback = (
3030
</svg>
3131
</div>
3232

33-
<h2 class="text-2xl font-bold mb-2 text-gray-700">网络异常</h2>
33+
<h2 class="text-2xl font-bold mb-2 text-zinc-700">网络异常</h2>
3434

35-
<p class="text-gray-600 mb-6">网络异常,请稍后再试</p>
35+
<p class="text-zinc-600 mb-6">网络异常,请稍后再试</p>
3636

3737
<div class="flex justify-center space-x-4">
3838
<a href="#/" class="py-2 px-4 bg-primary text-white rounded hover:bg-primary/85">
3939
重新加载
4040
</a>
41-
<a href="#/" class="py-2 px-4 bg-gray-200 text-gray-700 rounded hover:bg-gray-300">
41+
<a href="#/" class="py-2 px-4 bg-zinc-200 text-zinc-700 rounded hover:bg-zinc-300">
4242
返回首页
4343
</a>
4444
</div>

packages/omi-templates/src/components/navbar.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Navbar extends Component<Props> {
9393
class={classNames(
9494
'no-underline block px-4 py-2 hover:text-primary hover:bg-slate-100 dark:hover:bg-zinc-600 rounded-md p-2 dark:text-foreground',
9595
{
96-
'text-gray-600 md:text-gray-800': this.state.active !== navbarItemChild.value,
96+
'text-zinc-600 md:text-zinc-800': this.state.active !== navbarItemChild.value,
9797
'text-primary md:text-primary': this.state.active === navbarItemChild.value,
9898
'dark:bg-zinc-200/20': this.state.active === navbarItemChild.value,
9999
},
@@ -102,7 +102,7 @@ export class Navbar extends Component<Props> {
102102
href={`${navbarItemChild.href}`}
103103
>
104104
{navbarItemChild.text}
105-
<div class="w-3 h-3 inline-block text-gray-600 ml-1">
105+
<div class="w-3 h-3 inline-block text-zinc-600 ml-1">
106106
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" class="w-full h-full">
107107
<path d="M0 0h24v24H0V0z" fill="none" />
108108
<path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z" />
@@ -119,7 +119,7 @@ export class Navbar extends Component<Props> {
119119
class={classNames(
120120
'no-underline block px-4 py-2 hover:text-primary hover:bg-slate-100 dark:hover:bg-zinc-600 rounded-md p-2 dark:text-foreground',
121121
{
122-
'text-gray-600 md:text-gray-800': this.state.active !== navbarItemChild.value,
122+
'text-zinc-600 md:text-zinc-800': this.state.active !== navbarItemChild.value,
123123
'text-primary md:text-primary': this.state.active === navbarItemChild.value,
124124
'dark:bg-zinc-200/20': this.state.active === navbarItemChild.value,
125125
},
@@ -140,7 +140,7 @@ export class Navbar extends Component<Props> {
140140
onClick={this.onClick}
141141
data-collapse-toggle="navbar-multi-level"
142142
type="button"
143-
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
143+
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-zinc-500 rounded-lg md:hidden hover:bg-zinc-100 focus:outline-none focus:ring-2 focus:ring-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700 dark:focus:ring-zinc-600"
144144
aria-controls="navbar-multi-level"
145145
aria-expanded="false"
146146
>
@@ -199,7 +199,7 @@ export class Navbar extends Component<Props> {
199199
})}
200200
>
201201
<a
202-
class="block text-gray-800 cursor-pointer hover:text-primary p-2 md:py-1"
202+
class="block text-zinc-800 cursor-pointer hover:text-primary p-2 md:py-1"
203203
target={navbarItem.href ? navbarItem.target || '_blank' : '_self'}
204204
unsafeHTML={navbarItem.inner ? { html: navbarItem.inner } : null}
205205
href={
@@ -221,7 +221,7 @@ export class Navbar extends Component<Props> {
221221
{navbarItem.text}
222222
</span>
223223
{navbarItem.href && (
224-
<div class="w-3 h-3 inline-block text-gray-600 ml-1 dark:text-foreground">
224+
<div class="w-3 h-3 inline-block text-zinc-600 ml-1 dark:text-foreground">
225225
<svg
226226
xmlns="http://www.w3.org/2000/svg"
227227
fill="currentColor"
@@ -251,7 +251,7 @@ export class Navbar extends Component<Props> {
251251
</svg>
252252
)}
253253
{navbarItem.children && (
254-
<ul class="md:absolute md:left-1/2 md:-translate-x-1/2 w-auto mt-2 text-sm md:text-base dark:bg-background bg-[#fafafa] md:border static text-gray-600 overflow-hidden md:shadow-md md:invisible group-hover:visible transition-all duration-150 delay-100 rounded-md hover:text-primary">
254+
<ul class="md:absolute md:left-1/2 md:-translate-x-1/2 w-auto mt-2 text-sm md:text-base dark:bg-background bg-[#fafafa] md:border static text-zinc-600 overflow-hidden md:shadow-md md:invisible group-hover:visible transition-all duration-150 delay-100 rounded-md hover:text-primary">
255255
{navbarItem.children.map((navbarItemChild: NavbarItem) => {
256256
return this.renderNavbarItemChild(navbarItemChild)
257257
})}

packages/omi-templates/src/components/select.tsx packages/omi-templates/src/components/omiu/select.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Select extends Component<Props> {
105105
{this.props.options.map((option) => (
106106
<a
107107
href="javascript:"
108-
class="block px-4 py-2 text-sm hover:bg-zinc-100 rounded dark:hover:bg-zinc-400 hover:text-gray-900"
108+
class="block px-4 py-2 text-sm hover:bg-zinc-100 rounded dark:hover:bg-zinc-400 hover:text-zinc-900"
109109
role="menuitem"
110110
onClick={() => this.onSelectOption(option)}
111111
>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { Component, tag } from 'omi'
2+
3+
@tag('o-table')
4+
export class Table extends Component {
5+
render() {
6+
return (
7+
<div class="relative overflow-auto shadow-md sm:rounded-t-lg">
8+
<table class="table-fixed w-full text-sm text-left rtl:text-right background text-card-foreground">
9+
<thead class="text-xs uppercase">
10+
<tr>
11+
<th scope="col" class="p-4 w-4">
12+
<div class="flex items-center">
13+
<input
14+
id="checkbox-all-search"
15+
type="checkbox"
16+
class="w-4 h-4 border-zinc-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-zinc-800 dark:focus:ring-offset-zinc-800 focus:ring-2 er-zinc-600"
17+
/>
18+
<label for="checkbox-all-search" class="sr-only">
19+
checkbox
20+
</label>
21+
</div>
22+
</th>
23+
<th scope="col" class="px-6 py-3 w-32">
24+
产品名称
25+
</th>
26+
<th scope="col" class="px-6 py-3 w-24">
27+
颜色
28+
</th>
29+
<th scope="col" class="px-6 py-3 w-24">
30+
类型
31+
</th>
32+
<th scope="col" class="px-6 py-3 w-20">
33+
附件
34+
</th>
35+
<th scope="col" class="px-6 py-3 w-20">
36+
有货
37+
</th>
38+
<th scope="col" class="px-6 py-3 w-24">
39+
价格
40+
</th>
41+
<th scope="col" class="px-6 py-3 w-24">
42+
重量
43+
</th>
44+
<th scope="col" class="px-6 py-3 sticky w-32 background right-0 text-right">
45+
操作
46+
</th>
47+
</tr>
48+
</thead>
49+
<tbody>
50+
{Array(5)
51+
.fill(0)
52+
.map(() => {
53+
return (
54+
<tr class="group border-b dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-600">
55+
<td class="w-4 p-4">
56+
<div class="flex items-center">
57+
<input
58+
id="checkbox-table-search-1"
59+
type="checkbox"
60+
class="w-4 h-4 text-blue-600 bg-zinc-100 border-zinc-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-zinc-800 dark:focus:ring-offset-zinc-800 focus:ring-2 dark:bg-zinc-700 dark:border-zinc-600"
61+
/>
62+
<label for="checkbox-table-search-1" class="sr-only">
63+
checkbox
64+
</label>
65+
</div>
66+
</td>
67+
<th
68+
scope="row"
69+
class="px-6 py-4 font-medium text-zinc-900 whitespace-nowrap text-ellipsis overflow-hidden dark:text-white w-32"
70+
>
71+
苹果笔记本
72+
</th>
73+
<td class="px-6 py-4 w-24">银色</td>
74+
<td class="px-6 py-4 w-24">Laptop</td>
75+
<td class="px-6 py-4 w-20"></td>
76+
<td class="px-6 py-4 w-20"></td>
77+
<td class="px-6 py-4 w-24">¥12999</td>
78+
<td class="px-6 py-4 w-24">3.0kg</td>
79+
<td class=" items-center px-6 py-4 sticky w-32 right-0 background group-hover:bg-zinc-50 dark:group-hover:bg-zinc-600 text-right">
80+
<a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">
81+
编辑
82+
</a>
83+
<a href="#" class="font-medium text-red-600 dark:text-red-500 hover:underline ms-3">
84+
删除
85+
</a>
86+
</td>
87+
</tr>
88+
)
89+
})}
90+
</tbody>
91+
</table>
92+
</div>
93+
)
94+
}
95+
}

packages/omi-templates/src/components/omiu/tag.tsx

Whitespace-only changes.

packages/omi-templates/src/components/site-layout.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function SiteLayout(props: { hideFooter?: boolean; current?: string; chil
2020
<header class="bg-white dark:bg-background/10 dark:text-foreground bg-opacity-40 backdrop-filter backdrop-blur-md py-2 top-0 shadow fixed w-full px-4 md:px-0 z-[100000]">
2121
<div class="container mx-auto flex justify-between items-center">
2222
<div class="text-xl font-bold">
23-
<a class="text-gray-800 dark:text-white" title="TDesign" unsafeHTML={{ html: tdesignLogo }} href="#/"></a>
23+
<a class="text-zinc-800 dark:text-white" title="TDesign" unsafeHTML={{ html: tdesignLogo }} href="#/"></a>
2424
</div>
2525

2626
<div class="flex items-center">
@@ -36,7 +36,7 @@ export function SiteLayout(props: { hideFooter?: boolean; current?: string; chil
3636
<div class="container mx-auto py-12 grid grid-cols-1 md:grid-cols-4 gap-8">
3737
<div>
3838
<h2 class="text-xl font-bold mb-4">友情链接1</h2>
39-
<ul class="text-gray-600 dark:text-foreground">
39+
<ul class="text-zinc-600 dark:text-foreground">
4040
<li>
4141
<a href="#">链接1</a>
4242
</li>
@@ -50,7 +50,7 @@ export function SiteLayout(props: { hideFooter?: boolean; current?: string; chil
5050
</div>
5151
<div>
5252
<h2 class="text-xl font-bold mb-4">友情链接2</h2>
53-
<ul class="text-gray-600 dark:text-foreground">
53+
<ul class="text-zinc-600 dark:text-foreground">
5454
<li>
5555
<a href="#">链接1</a>
5656
</li>
@@ -64,7 +64,7 @@ export function SiteLayout(props: { hideFooter?: boolean; current?: string; chil
6464
</div>
6565
<div>
6666
<h2 class="text-xl font-bold mb-4">友情链接3</h2>
67-
<ul class="text-gray-600 dark:text-foreground">
67+
<ul class="text-zinc-600 dark:text-foreground">
6868
<li>
6969
<a href="#">链接1</a>
7070
</li>
@@ -78,7 +78,7 @@ export function SiteLayout(props: { hideFooter?: boolean; current?: string; chil
7878
</div>
7979
<div>
8080
<h2 class="text-xl font-bold mb-4">友情链接4</h2>
81-
<ul class="text-gray-600 dark:text-foreground">
81+
<ul class="text-zinc-600 dark:text-foreground">
8282
<li>
8383
<a href="#">链接1</a>
8484
</li>
@@ -99,7 +99,7 @@ export function SiteLayout(props: { hideFooter?: boolean; current?: string; chil
9999
{!props.hideFooter && (
100100
<footer class="bg-[#e7e7e7] border-t dark:bg-background dark:text-foreground py-6">
101101
<div class="container mx-auto text-center">
102-
<p class="text-gray-600 dark:text-foreground">© 2024 Tencent OMI. All rights reserved.</p>
102+
<p class="text-zinc-600 dark:text-foreground">© 2024 Tencent OMI. All rights reserved.</p>
103103
</div>
104104
</footer>
105105
)}

0 commit comments

Comments
 (0)