From 8222f10259848a73b5cd74f6681529f71fc35bfb Mon Sep 17 00:00:00 2001 From: aibayanyu Date: Mon, 6 Mar 2023 07:29:33 +0800 Subject: [PATCH] feat: add delete button --- components/button/index.tsx | 33 --------------------------------- components/theme/index.ts | 30 ------------------------------ site/demos/button/basic.vue | 8 ++------ 3 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 components/button/index.tsx delete mode 100644 components/theme/index.ts diff --git a/components/button/index.tsx b/components/button/index.tsx deleted file mode 100644 index d5eddde..0000000 --- a/components/button/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { computed, defineComponent } from 'vue' -import type { CSSInterpolation } from '@antd-tiny-vue/cssinjs' -import { useStyleRegister } from '@antd-tiny-vue/cssinjs' -import type { ThemeToken } from '../theme' -import { useToken } from '../theme' - -export const generateButtonStyle = (prefixCls: string, token: ThemeToken): CSSInterpolation => ({ - [`.${prefixCls}`]: { - backgroundColor: token.primaryColor, - padding: '10px 20px', - '&:hover': { - backgroundColor: 'red' - } - } -}) - -const Button = defineComponent({ - name: 'AButton', - setup() { - const prefixCls = 'ant-btn' - const [theme, token, hashId] = useToken() - const info = computed(() => ({ - theme: theme.value, - token: token.value, - path: [prefixCls], - hashId: hashId.value - })) - const wrapSSR = useStyleRegister(info, () => [generateButtonStyle(prefixCls, token.value as any)]) - return () => wrapSSR() - } -}) - -export default Button diff --git a/components/theme/index.ts b/components/theme/index.ts deleted file mode 100644 index 31b19a0..0000000 --- a/components/theme/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { createTheme, useCacheToken } from '@antd-tiny-vue/cssinjs' -import { computed } from 'vue' - -export interface ThemeToken { - primaryColor: string -} - -export const defaultTheme: ThemeToken = { - primaryColor: '#1890ff' -} - -function derivative(theme: ThemeToken) { - return { - ...theme - } -} - -const theme = createTheme(derivative) - -export const useToken = () => { - const mergedTheme = computed(() => theme) - const cacheToken = useCacheToken( - mergedTheme, - computed(() => [defaultTheme]), - computed(() => ({ - salt: 'true' - })) - ) - return [mergedTheme, computed(() => cacheToken.value[0]), computed(() => cacheToken.value[1])] -} diff --git a/site/demos/button/basic.vue b/site/demos/button/basic.vue index 9b87b67..89b66b1 100644 --- a/site/demos/button/basic.vue +++ b/site/demos/button/basic.vue @@ -7,14 +7,10 @@ title: 基础按钮 - +