diff --git a/packages/theme-generator/README.md b/packages/theme-generator/README.md index 5005c029..5ca200b4 100644 --- a/packages/theme-generator/README.md +++ b/packages/theme-generator/README.md @@ -4,9 +4,11 @@ ### 🏗️ Develop -- `npm run dev` - +- `npm install` +- `npm run build` +- `npm link` - `npm run build:watch` execute `npm link` as well to preview in application project +- Use `npm link tdesign-theme-generator` in the `site` branch of `tdesign-vue-next-starter` ### ⚙️ Build diff --git a/packages/theme-generator/src/common/Themes/const.js b/packages/theme-generator/src/common/Themes/const.js index b09b541c..855a4ba6 100644 --- a/packages/theme-generator/src/common/Themes/const.js +++ b/packages/theme-generator/src/common/Themes/const.js @@ -10,24 +10,34 @@ import TencentHealthcare from "!raw-loader!./svg/TencentHealthcare"; import TencentGames from "!raw-loader!./svg/TencentGames"; import TencentSafe from "!raw-loader!./svg/TencentSafe"; +// export const UPLOAD_LIMIT_EXCEEDED_MESSAGE = { +// en: "Upload limit exceeded", +// zh: "超过上传数量" +// }; + export const defaultTheme = { + id: "DEFAULT", name: "默认主题", - enName:'TDesign', + enName: 'TDesign', subtitle: TDesignOriginal, - subtitleText:'TDesign Original', + subtitleText: 'TDesign Original', + subBgColor: '#0052D9', value: "#0052D9", }; +/** 确保 id,title 唯一 */ export const RECOMMEND_THEMES = [ { - title: "官方推荐", + id: "OFFICIAL", + title: "officialRecommendation", options: [ defaultTheme, { name: "腾讯云", - enName:'TCloud', + enName: 'TCloud', subtitle: TencentCloud, - subtitleText:'Tencent Cloud', + subtitleText: 'Tencent Cloud', + subBgColor: '#006EFF', value: "#006EFF", }, // { @@ -65,6 +75,18 @@ export const RECOMMEND_THEMES = [ ], }, // { + // id: "CUSTOM", + // title: "customUpload", + // options: [ + // { + // name: "自定义上传", + // enName: 'Custom Upload', + // subtitle: TencentSafe, + // value: "#623BFF", + // } + // ] + // } + // { // title: "业务推荐", // options: [ // { @@ -86,3 +108,17 @@ export const RECOMMEND_THEMES = [ // ], // }, ]; + +export const UPLOAD_THEMES = { + id: "CUSTOM", + title: "customUpload", + options: { + id: "CUSTOM", + name: "自定义上传", + enName: 'Custom Upload', + subtitle: TencentSafe, + subtitleText: 'Tencent Cloud', + subBgColor: '#623BFF', + value: "#623BFF", + } +} \ No newline at end of file diff --git a/packages/theme-generator/src/common/Themes/index.vue b/packages/theme-generator/src/common/Themes/index.vue index dd17cd3e..47ab111e 100644 --- a/packages/theme-generator/src/common/Themes/index.vue +++ b/packages/theme-generator/src/common/Themes/index.vue @@ -1,72 +1,214 @@ @@ -76,6 +218,21 @@ export default { max-height: 376px; border-radius: 32px 32px 0px 0px; + &__title-group { + display: flex; + } + + &__title { + color: var(--text-primary); + font-weight: 600; + font-size: 14px; + margin: 8px 0px 0px 12px; + line-height: 22px; + display: flex; + align-items: center; + cursor: pointer; + } + &__content { padding: 0; overflow: auto; @@ -103,23 +260,13 @@ export default { padding: 12px 4px 16px 16px; } - &__title { - color: var(--text-primary); - font-weight: 600; - font-size: 14px; - margin: 8px 0px 0px 12px; - line-height: 22px; - display: flex; - align-items: center; - } - &__flex { display: flex; flex-wrap: wrap; margin: 4px -4px; cursor: pointer; - > div { + >div { margin: 4px; padding: 6px 6px 0px 6px; color: var(--text-primary); @@ -139,6 +286,7 @@ export default { border-radius: 12px; position: relative; overflow: hidden; + &--active { position: absolute; right: 0px; @@ -147,5 +295,4 @@ export default { } } } - - + \ No newline at end of file diff --git a/packages/theme-generator/src/common/i18n/en-US.js b/packages/theme-generator/src/common/i18n/en-US.js index bc97979e..c3c33366 100644 --- a/packages/theme-generator/src/common/i18n/en-US.js +++ b/packages/theme-generator/src/common/i18n/en-US.js @@ -1,7 +1,8 @@ export default { copied: "copied", dock: { - recommendTitle: "Official recommendation", + officialRecommendation: "Official recommendation", + customUpload: "Custom upload", adjustText: "Variables", recoverConfirm: 'Are you sure to recover TDesign default theme?', downloadTips: 'current theme has been downloaded', diff --git a/packages/theme-generator/src/common/i18n/zh-CN.js b/packages/theme-generator/src/common/i18n/zh-CN.js index 1f8aa16b..6f9d8040 100644 --- a/packages/theme-generator/src/common/i18n/zh-CN.js +++ b/packages/theme-generator/src/common/i18n/zh-CN.js @@ -1,7 +1,8 @@ export default { copied: "已复制", dock: { - recommendTitle: "官方推荐", + officialRecommendation: "官方推荐", + customUpload: "自定义上传", adjustText: "主参数调节", recoverConfirm: "你确定恢复 TDesign 的默认主题吗?", downloadTips: "已下载当前主题配置文件", diff --git a/packages/theme-generator/src/common/utils/index.js b/packages/theme-generator/src/common/utils/index.js index 65ae7ffd..c349dc1c 100644 --- a/packages/theme-generator/src/common/utils/index.js +++ b/packages/theme-generator/src/common/utils/index.js @@ -42,6 +42,7 @@ export function appendStyleSheet(themeId) { } // generator new theme variables and insert into document +/** @deprecated */ export function generateNewTheme(hex, remainInput = true) { // hex 主题色 let styleSheet = appendStyleSheet(customTheme); diff --git a/packages/theme-generator/src/dock/index.vue b/packages/theme-generator/src/dock/index.vue index 963ef98d..0c791711 100644 --- a/packages/theme-generator/src/dock/index.vue +++ b/packages/theme-generator/src/dock/index.vue @@ -46,7 +46,7 @@ -
+
{{ isEn ? currentTheme.enName : currentTheme.name }}