From 1558ab09bcb5679af5939d10ae031442077b0692 Mon Sep 17 00:00:00 2001 From: wangdicoder Date: Wed, 8 Apr 2026 21:24:27 +1000 Subject: [PATCH 01/12] fix: update card ui --- .../src/containers/theme-studio/index.tsx | 4 +- .../theme-studio/preview-components.tsx | 519 +++++++++++------- .../containers/theme-studio/theme-studio.scss | 300 +++++++++- packages/react/src/cascader/style/index.scss | 1 + .../react/src/date-picker/style/index.scss | 4 + .../react/src/form/demo/OtherControls.tsx | 15 +- .../react/src/form/demo/SizeAlignment.tsx | 63 +++ packages/react/src/form/index.md | 13 +- packages/react/src/form/index.zh_CN.md | 15 +- .../react/src/native-select/style/_mixin.scss | 4 +- .../react/src/native-select/style/index.scss | 12 +- packages/react/src/select/style/index.scss | 4 + .../__snapshots__/textarea.test.tsx.snap | 46 +- .../src/textarea/__tests__/textarea.test.tsx | 48 ++ packages/react/src/textarea/demo/Resize.tsx | 16 + packages/react/src/textarea/index.md | 15 +- packages/react/src/textarea/index.zh_CN.md | 15 +- packages/react/src/textarea/style/index.scss | 69 ++- packages/react/src/textarea/textarea.tsx | 108 +++- packages/react/src/textarea/types.ts | 13 +- .../react/src/time-picker/style/index.scss | 4 + 21 files changed, 1026 insertions(+), 262 deletions(-) create mode 100644 packages/react/src/form/demo/SizeAlignment.tsx create mode 100644 packages/react/src/textarea/demo/Resize.tsx diff --git a/apps/docs/src/containers/theme-studio/index.tsx b/apps/docs/src/containers/theme-studio/index.tsx index b634583c..31ed0408 100644 --- a/apps/docs/src/containers/theme-studio/index.tsx +++ b/apps/docs/src/containers/theme-studio/index.tsx @@ -194,9 +194,7 @@ const ThemeStudioPage = (): React.ReactElement => { -
- {renderPreview(draft.activeTemplate, draft.fields, draft.activeSection)} -
+ {renderPreview(draft.activeTemplate, draft.fields, draft.activeSection)} diff --git a/apps/docs/src/containers/theme-studio/preview-components.tsx b/apps/docs/src/containers/theme-studio/preview-components.tsx index 9528fcc1..243c88cb 100644 --- a/apps/docs/src/containers/theme-studio/preview-components.tsx +++ b/apps/docs/src/containers/theme-studio/preview-components.tsx @@ -4,9 +4,9 @@ import { Avatar, Button, Card, - Calendar, Checkbox, DatePicker, + Divider, Flex, Grid, Input, @@ -19,7 +19,7 @@ import { Tag, Textarea, Typography, - Waterfall, + Calendar, } from '@tiny-design/react'; import { ChartContainer, @@ -27,26 +27,10 @@ import { ChartTooltipContent, type ChartConfig, } from '@tiny-design/charts'; -import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from 'recharts'; +import { Area, AreaChart, Bar, BarChart, CartesianGrid, Line, LineChart, XAxis, YAxis } from 'recharts'; import { swatchTextStyle } from './editor-fields'; import type { ThemeEditorFields, ThemeEditorSection, ThemePreviewTemplate } from './types'; - -const exerciseData = [ - { day: 'Mon', minutes: 34 }, - { day: 'Tue', minutes: 52 }, - { day: 'Wed', minutes: 49 }, - { day: 'Thu', minutes: 63 }, - { day: 'Fri', minutes: 58 }, - { day: 'Sat', minutes: 71 }, - { day: 'Sun', minutes: 66 }, -]; - -const exerciseChartConfig: ChartConfig = { - minutes: { - label: 'Minutes', - color: 'var(--ty-chart-1)', - }, -}; +import { IconGithub, IconGoogle } from '@tiny-design/icons'; const revenueData = [ { month: 'Jan', revenue: 4200, target: 3800 }, @@ -68,6 +52,82 @@ const revenueChartConfig: ChartConfig = { }, }; +const cardsRevenueData = [ + { month: 'Jan', value: 8.4 }, + { month: 'Feb', value: 7.2 }, + { month: 'Mar', value: 7.8 }, + { month: 'Apr', value: 6.9 }, + { month: 'May', value: 7.4 }, + { month: 'Jun', value: 8.1 }, + { month: 'Jul', value: 12.4 }, +]; + +const cardsRevenueChartConfig: ChartConfig = { + value: { + label: 'Revenue', + color: 'var(--ty-chart-4)', + }, +}; + +const moveGoalData = [ + { key: 'm1', dayLabel: 'M', value: 280 }, + { key: 't1', dayLabel: 'T', value: 340 }, + { key: 'w1', dayLabel: 'W', value: 220 }, + { key: 'th1', dayLabel: 'T', value: 310 }, + { key: 'f1', dayLabel: 'F', value: 360 }, + { key: 's1', dayLabel: 'S', value: 240 }, + { key: 'su1', dayLabel: 'S', value: 300 }, + { key: 'm2', dayLabel: 'M', value: 330 }, + { key: 't2', dayLabel: 'T', value: 260 }, + { key: 'w2', dayLabel: 'W', value: 320 }, + { key: 'th2', dayLabel: 'T', value: 350 }, + { key: 'f2', dayLabel: 'F', value: 290 }, +]; + +const moveGoalChartConfig: ChartConfig = { + value: { + label: 'Calories', + color: 'var(--ty-chart-1)', + }, +}; + +const cardsExerciseData = [ + { month: 'Mar', personal: 18, average: 22 }, + { month: 'Apr', personal: 14, average: 18 }, + { month: 'May', personal: 58, average: 26 }, + { month: 'Jun', personal: 28, average: 24 }, + { month: 'Jul', personal: 22, average: 20 }, + { month: 'Aug', personal: 26, average: 23 }, +]; + +const cardsExerciseChartConfig: ChartConfig = { + personal: { + label: 'You', + color: 'var(--ty-chart-2)', + }, + average: { + label: 'Average', + color: 'var(--ty-chart-5)', + }, +}; + +const subscriptionsData = [ + { month: 'Jan', value: 400 }, + { month: 'Feb', value: 620 }, + { month: 'Mar', value: 980 }, + { month: 'Apr', value: 1480 }, + { month: 'May', value: 1910 }, + { month: 'Jun', value: 880 }, + { month: 'Jul', value: 2350 }, +]; + +const subscriptionsChartConfig: ChartConfig = { + value: { + label: 'Subscriptions', + color: 'var(--editor-card-foreground)', + }, +}; + function MetricsStrip({ items = [ ['Total Revenue', '$15,231.89', '+20.1% from last month'], @@ -154,103 +214,124 @@ function LiveResponsePanel({ fields }: { fields: ThemeEditorFields }): React.Rea } function CardsPreview(): React.ReactElement { - const items = [ - { - key: 'metric-revenue', - children: ( - - -
- Total Revenue - $15,231.89 - +20.1% from last month -
-
-
- ), - }, - { - key: 'metric-subscriptions', - children: ( - - -
- Subscriptions - +2,350 - +180.1% from last month -
-
-
- ), - }, - { - key: 'upgrade', - children: ( - + return ( +
+
+
+ + +
+
+ Total Revenue + +20.1% from last month +
+
+ $15,231.89 + + + + + } /> + + + +
+
+ + + +
+
+ Subscriptions + +180.1% from last month +
+
+ +2,350 + + + + + + + + + + + } /> + + + +
+
+
+ + -
- Billing - Update your seat plan before the next invoice. +
+ Upgrade your subscription + + You are currently on the free plan. Upgrade to the pro plan to get access to all features. +
- - You are currently on the free plan. Upgrade to the pro plan to get access to all features. -
- - + + + + - - + + -
- Plan - Select the plan that best fits your needs. - - - Starter Plan - Pro Plan - - -
-