flatten folder design-system

This commit is contained in:
2026-02-24 07:56:21 +08:00
parent 690222ccb7
commit 72ced7866e
51 changed files with 94 additions and 95 deletions

View File

@@ -1,7 +1,7 @@
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { PageLayout } from "@/components/ui/PageLayout"; import { PageLayout } from "@/components/ui/PageLayout";
import { LightButton, LinkButton } from "@/design-system/base/button/button"; import { LightButton, LinkButton } from "@/design-system/base/button";
import { actionGetUserProfileByUsername } from "@/modules/auth/auth-action"; import { actionGetUserProfileByUsername } from "@/modules/auth/auth-action";
import { repoGetFoldersWithTotalPairsByUserId } from "@/modules/folder/folder-repository"; import { repoGetFoldersWithTotalPairsByUserId } from "@/modules/folder/folder-repository";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";

View File

@@ -3,11 +3,11 @@
import { useState, useEffect, useCallback } from "react"; import { useState, useEffect, useCallback } from "react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { Letter, SupportedAlphabets } from "@/lib/interfaces"; import { Letter, SupportedAlphabets } from "@/lib/interfaces";
import { IconClick, CircleToggleButton, CircleButton, PrimaryButton } from "@/design-system/base/button/button"; import { IconClick, CircleToggleButton, CircleButton, PrimaryButton } from "@/design-system/base/button";
import { IMAGES } from "@/config/images"; import { IMAGES } from "@/config/images";
import { ChevronLeft, ChevronRight } from "lucide-react"; import { ChevronLeft, ChevronRight } from "lucide-react";
import { PageLayout } from "@/components/ui/PageLayout"; import { PageLayout } from "@/components/ui/PageLayout";
import { Card } from "@/design-system/base/card/card"; import { Card } from "@/design-system/base/card";
interface AlphabetCardProps { interface AlphabetCardProps {
alphabet: Letter[]; alphabet: Letter[];

View File

@@ -1,5 +1,5 @@
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { IconClick } from "@/design-system/base/button/button"; import { IconClick } from "@/design-system/base/button";
import { IMAGES } from "@/config/images"; import { IMAGES } from "@/config/images";
import { Letter, SupportedAlphabets } from "@/lib/interfaces"; import { Letter, SupportedAlphabets } from "@/lib/interfaces";
import { import {

View File

@@ -4,7 +4,7 @@ import { useState, useEffect } from "react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { Letter, SupportedAlphabets } from "@/lib/interfaces"; import { Letter, SupportedAlphabets } from "@/lib/interfaces";
import { PageLayout } from "@/components/ui/PageLayout"; import { PageLayout } from "@/components/ui/PageLayout";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { AlphabetCard } from "./AlphabetCard"; import { AlphabetCard } from "./AlphabetCard";
export default function Alphabet() { export default function Alphabet() {

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { Input } from "@/design-system/base/input/input"; import { Input } from "@/design-system/base/input";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useState } from "react"; import { useState } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { Plus, RefreshCw } from "lucide-react"; import { Plus, RefreshCw } from "lucide-react";
import { CircleButton, LightButton } from "@/design-system/base/button/button"; import { CircleButton, LightButton } from "@/design-system/base/button";
import { toast } from "sonner"; import { toast } from "sonner";
import { actionCreatePair } from "@/modules/folder/folder-aciton"; import { actionCreatePair } from "@/modules/folder/folder-aciton";
import { TSharedItem } from "@/shared/dictionary-type"; import { TSharedItem } from "@/shared/dictionary-type";

View File

@@ -6,7 +6,7 @@ import Link from "next/link";
import { Folder as Fd } from "lucide-react"; import { Folder as Fd } from "lucide-react";
import { TSharedFolderWithTotalPairs } from "@/shared/folder-type"; import { TSharedFolderWithTotalPairs } from "@/shared/folder-type";
import { PageLayout } from "@/components/ui/PageLayout"; import { PageLayout } from "@/components/ui/PageLayout";
import { PrimaryButton } from "@/design-system/base/button/button"; import { PrimaryButton } from "@/design-system/base/button";
interface FolderSelectorProps { interface FolderSelectorProps {
folders: TSharedFolderWithTotalPairs[]; folders: TSharedFolderWithTotalPairs[];

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { useState } from "react"; import { useState } from "react";
import { LinkButton, CircleToggleButton, LightButton } from "@/design-system/base/button/button"; import { LinkButton, CircleToggleButton, LightButton } from "@/design-system/base/button";
import { useAudioPlayer } from "@/hooks/useAudioPlayer"; import { useAudioPlayer } from "@/hooks/useAudioPlayer";
import { getTTSUrl, TTS_SUPPORTED_LANGUAGES } from "@/lib/bigmodel/tts"; import { getTTSUrl, TTS_SUPPORTED_LANGUAGES } from "@/lib/bigmodel/tts";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";

View File

@@ -1,6 +1,6 @@
import { useState, useRef, forwardRef, useEffect, useCallback } from "react"; import { useState, useRef, forwardRef, useEffect, useCallback } from "react";
import { SubtitleDisplay } from "./SubtitleDisplay"; import { SubtitleDisplay } from "./SubtitleDisplay";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { RangeInput } from "@/components/ui/RangeInput"; import { RangeInput } from "@/components/ui/RangeInput";
import { getIndex, parseSrt, getNearistIndex } from "../subtitle"; import { getIndex, parseSrt, getNearistIndex } from "../subtitle";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import React, { useRef } from "react"; import React, { useRef } from "react";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { FileInputProps } from "../../types/controls"; import { FileInputProps } from "../../types/controls";
interface FileInputComponentProps extends FileInputProps { interface FileInputComponentProps extends FileInputProps {

View File

@@ -2,7 +2,7 @@
import React from "react"; import React from "react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { PlayButtonProps } from "../../types/player"; import { PlayButtonProps } from "../../types/player";
export function PlayButton({ isPlaying, onToggle, disabled, className }: PlayButtonProps) { export function PlayButton({ isPlaying, onToggle, disabled, className }: PlayButtonProps) {

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import React from "react"; import React from "react";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { SpeedControlProps } from "../../types/player"; import { SpeedControlProps } from "../../types/player";
import { getPlaybackRateOptions, getPlaybackRateLabel } from "../../utils/timeUtils"; import { getPlaybackRateOptions, getPlaybackRateLabel } from "../../utils/timeUtils";

View File

@@ -3,7 +3,7 @@
import React from "react"; import React from "react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { ChevronLeft, ChevronRight, RotateCcw, Pause } from "lucide-react"; import { ChevronLeft, ChevronRight, RotateCcw, Pause } from "lucide-react";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { ControlBarProps } from "../../types/controls"; import { ControlBarProps } from "../../types/controls";
import { PlayButton } from "../atoms/PlayButton"; import { PlayButton } from "../atoms/PlayButton";
import { SpeedControl } from "../atoms/SpeedControl"; import { SpeedControl } from "../atoms/SpeedControl";

View File

@@ -4,7 +4,7 @@ import React from "react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { toast } from "sonner"; import { toast } from "sonner";
import { Video, FileText } from "lucide-react"; import { Video, FileText } from "lucide-react";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { FileUploadProps } from "../../types/controls"; import { FileUploadProps } from "../../types/controls";
import { useFileUpload } from "../../hooks/useFileUpload"; import { useFileUpload } from "../../hooks/useFileUpload";

View File

@@ -15,7 +15,7 @@ import { SubtitleArea } from "./components/compounds/SubtitleArea";
import { ControlBar } from "./components/compounds/ControlBar"; import { ControlBar } from "./components/compounds/ControlBar";
import { UploadZone } from "./components/compounds/UploadZone"; import { UploadZone } from "./components/compounds/UploadZone";
import { SeekBar } from "./components/atoms/SeekBar"; import { SeekBar } from "./components/atoms/SeekBar";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
export default function SrtPlayerPage() { export default function SrtPlayerPage() {
const t = useTranslations("home"); const t = useTranslations("home");

View File

@@ -6,7 +6,7 @@ import {
TextSpeakerArraySchema, TextSpeakerArraySchema,
TextSpeakerItemSchema, TextSpeakerItemSchema,
} from "@/lib/interfaces"; } from "@/lib/interfaces";
import { IconClick } from "@/design-system/base/button/button"; import { IconClick } from "@/design-system/base/button";
import { IMAGES } from "@/config/images"; import { IMAGES } from "@/config/images";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { getLocalStorageOperator } from "@/lib/browser/localStorageOperators"; import { getLocalStorageOperator } from "@/lib/browser/localStorageOperators";

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { IconClick } from "@/design-system/base/button/button"; import { IconClick } from "@/design-system/base/button";
import { IMAGES } from "@/config/images"; import { IMAGES } from "@/config/images";
import { useAudioPlayer } from "@/hooks/useAudioPlayer"; import { useAudioPlayer } from "@/hooks/useAudioPlayer";
import { import {

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { LightButton, PrimaryButton, IconClick } from "@/design-system/base/button/button"; import { LightButton, PrimaryButton, IconClick } from "@/design-system/base/button";
import { IMAGES } from "@/config/images"; import { IMAGES } from "@/config/images";
import { useAudioPlayer } from "@/hooks/useAudioPlayer"; import { useAudioPlayer } from "@/hooks/useAudioPlayer";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";

View File

@@ -7,7 +7,7 @@ import {
FolderPlus, FolderPlus,
Trash2, Trash2,
} from "lucide-react"; } from "lucide-react";
import { CircleButton, LightButton } from "@/design-system/base/button/button"; import { CircleButton, LightButton } from "@/design-system/base/button";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";

View File

@@ -1,5 +1,5 @@
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { Input } from "@/design-system/base/input/input"; import { Input } from "@/design-system/base/input";
import { LocaleSelector } from "@/components/ui/LocaleSelector"; import { LocaleSelector } from "@/components/ui/LocaleSelector";
import { X } from "lucide-react"; import { X } from "lucide-react";
import { useRef, useState } from "react"; import { useRef, useState } from "react";

View File

@@ -7,7 +7,7 @@ import { AddTextPairModal } from "./AddTextPairModal";
import { TextPairCard } from "./TextPairCard"; import { TextPairCard } from "./TextPairCard";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { PageLayout } from "@/components/ui/PageLayout"; import { PageLayout } from "@/components/ui/PageLayout";
import { PrimaryButton, CircleButton, LinkButton } from "@/design-system/base/button/button"; import { PrimaryButton, CircleButton, LinkButton } from "@/design-system/base/button";
import { CardList } from "@/components/ui/CardList"; import { CardList } from "@/components/ui/CardList";
import { actionCreatePair, actionDeletePairById, actionGetPairsByFolderId } from "@/modules/folder/folder-aciton"; import { actionCreatePair, actionDeletePairById, actionGetPairsByFolderId } from "@/modules/folder/folder-aciton";
import { TSharedPair } from "@/shared/folder-type"; import { TSharedPair } from "@/shared/folder-type";

View File

@@ -1,6 +1,6 @@
import { Edit, Trash2 } from "lucide-react"; import { Edit, Trash2 } from "lucide-react";
import { useState } from "react"; import { useState } from "react";
import { CircleButton } from "@/design-system/base/button/button"; import { CircleButton } from "@/design-system/base/button";
import { UpdateTextPairModal } from "./UpdateTextPairModal"; import { UpdateTextPairModal } from "./UpdateTextPairModal";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { TSharedPair } from "@/shared/folder-type"; import { TSharedPair } from "@/shared/folder-type";

View File

@@ -1,5 +1,5 @@
import { LightButton } from "@/design-system/base/button/button"; import { LightButton } from "@/design-system/base/button";
import { Input } from "@/design-system/base/input/input"; import { Input } from "@/design-system/base/input";
import { LocaleSelector } from "@/components/ui/LocaleSelector"; import { LocaleSelector } from "@/components/ui/LocaleSelector";
import { X } from "lucide-react"; import { X } from "lucide-react";
import { useRef, useState } from "react"; import { useRef, useState } from "react";

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { GhostLightButton } from "@/design-system/base/button/button"; import { GhostLightButton } from "@/design-system/base/button";
import { useState } from "react"; import { useState } from "react";
import { Languages } from "lucide-react"; import { Languages } from "lucide-react";

View File

@@ -5,7 +5,7 @@ import { LanguageSettings } from "./LanguageSettings";
import { auth } from "@/auth"; import { auth } from "@/auth";
import { headers } from "next/headers"; import { headers } from "next/headers";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { GhostLightButton } from "@/design-system/base/button/button"; import { GhostLightButton } from "@/design-system/base/button";
export async function Navbar() { export async function Navbar() {
const t = await getTranslations("navbar"); const t = await getTranslations("navbar");

View File

@@ -3,7 +3,7 @@
* *
* 使用 Design System 重写的卡片列表组件 * 使用 Design System 重写的卡片列表组件
*/ */
import { VStack } from "@/design-system/layout/stack/stack"; import { VStack } from "@/design-system/layout/stack";
interface CardListProps { interface CardListProps {
children: React.ReactNode; children: React.ReactNode;

View File

@@ -3,8 +3,8 @@
* *
* 使用 Design System 重写的容器组件 * 使用 Design System 重写的容器组件
*/ */
import { Container as DSContainer } from "@/design-system/layout/container/container"; import { Container as DSContainer } from "@/design-system/layout/container";
import { Card } from "@/design-system/base/card/card"; import { Card } from "@/design-system/base/card";
interface ContainerProps { interface ContainerProps {
children?: React.ReactNode; children?: React.ReactNode;

View File

@@ -5,9 +5,9 @@
*/ */
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useState } from "react"; import { useState } from "react";
import { Input } from "@/design-system/base/input/input"; import { Input } from "@/design-system/base/input";
import { Select } from "@/design-system/base/select/select"; import { Select } from "@/design-system/base/select";
import { VStack } from "@/design-system/layout/stack/stack"; import { VStack } from "@/design-system/layout/stack";
const COMMON_LANGUAGES = [ const COMMON_LANGUAGES = [
{ label: "chinese", value: "chinese" }, { label: "chinese", value: "chinese" },

View File

@@ -3,7 +3,7 @@
* *
* 使用 Design System 重写的页面标题组件 * 使用 Design System 重写的页面标题组件
*/ */
import { VStack } from "@/design-system/layout/stack/stack"; import { VStack } from "@/design-system/layout/stack";
interface PageHeaderProps { interface PageHeaderProps {
title: string; title: string;

View File

@@ -3,8 +3,8 @@
* *
* 使用 Design System 重写的页面布局组件 * 使用 Design System 重写的页面布局组件
*/ */
import { Card } from "@/design-system/base/card/card"; import { Card } from "@/design-system/base/card";
import { Container } from "@/design-system/layout/container/container"; import { Container } from "@/design-system/layout/container";
type PageLayoutVariant = "centered-card" | "full-width" | "fullscreen"; type PageLayoutVariant = "centered-card" | "full-width" | "fullscreen";

View File

@@ -2,10 +2,10 @@
// 可以从 '@/components/ui' 导入所有组件 // 可以从 '@/components/ui' 导入所有组件
// Design System 组件(向后兼容) // Design System 组件(向后兼容)
export { Input, type InputVariant, type InputProps } from '@/design-system/base/input/input'; export { Input, type InputVariant, type InputProps } from '@/design-system/base/input';
export { Select, type SelectVariant, type SelectSize, type SelectProps } from '@/design-system/base/select/select'; export { Select, type SelectVariant, type SelectSize, type SelectProps } from '@/design-system/base/select';
export { Textarea, type TextareaVariant, type TextareaProps } from '@/design-system/base/textarea/textarea'; export { Textarea, type TextareaVariant, type TextareaProps } from '@/design-system/base/textarea';
export { Card, type CardVariant, type CardPadding, type CardProps } from '@/design-system/base/card/card'; export { Card, type CardVariant, type CardPadding, type CardProps } from '@/design-system/base/card';
export { export {
Button, Button,
PrimaryButton, PrimaryButton,
@@ -18,7 +18,7 @@ export {
type ButtonVariant, type ButtonVariant,
type ButtonSize, type ButtonSize,
type ButtonProps type ButtonProps
} from '@/design-system/base/button/button'; } from '@/design-system/base/button';
// 业务特定组件 // 业务特定组件
export { RangeInput } from './RangeInput'; export { RangeInput } from './RangeInput';

View File

@@ -6,33 +6,32 @@
``` ```
src/design-system/ src/design-system/
├── tokens/ # 设计令牌(颜色、间距、字体等)
├── lib/ # 工具函数 ├── lib/ # 工具函数
├── base/ # 基础组件 ├── base/ # 基础组件
│ ├── button/ │ ├── button.tsx
│ ├── input/ │ ├── input.tsx
│ ├── textarea/ │ ├── textarea.tsx
│ ├── card/ │ ├── card.tsx
│ ├── checkbox/ │ ├── checkbox.tsx
│ ├── radio/ │ ├── radio.tsx
│ ├── switch/ │ ├── switch.tsx
│ └── select/ │ └── select.tsx
├── feedback/ # 反馈组件 ├── feedback/ # 反馈组件
│ ├── alert/ │ ├── alert.tsx
│ ├── progress/ │ ├── progress.tsx
│ ├── skeleton/ │ ├── skeleton.tsx
│ └── toast/ │ └── toast.tsx
├── overlay/ # 覆盖组件 ├── overlay/ # 覆盖组件
│ └── modal/ │ └── modal.tsx
├── data-display/ # 数据展示组件 ├── data-display/ # 数据展示组件
│ ├── badge/ │ ├── badge.tsx
│ └── divider/ │ └── divider.tsx
├── layout/ # 布局组件 ├── layout/ # 布局组件
│ ├── container/ │ ├── container.tsx
│ ├── grid/ │ ├── grid.tsx
│ └── stack/ │ └── stack.tsx
── navigation/ # 导航组件 ── navigation/ # 导航组件
└── tabs/ └── tabs.tsx
``` ```
## 快速开始 ## 快速开始
@@ -47,16 +46,16 @@ pnpm add class-variance-authority clsx tailwind-merge
```tsx ```tsx
// 使用显式导入以获得更好的 tree-shaking // 使用显式导入以获得更好的 tree-shaking
import { Button } from '@/design-system/base/button/button'; import { Button } from '@/design-system/base/button';
import { Input } from '@/design-system/base/input/input'; import { Input } from '@/design-system/base/input';
import { Card } from '@/design-system/base/card/card'; import { Card } from '@/design-system/base/card';
``` ```
### 使用组件 ### 使用组件
```tsx ```tsx
import { Button } from '@/design-system/base/button/button'; import { Button } from '@/design-system/base/button';
import { Card } from '@/design-system/base/card/card'; import { Card } from '@/design-system/base/card';
export function MyComponent() { export function MyComponent() {
return ( return (
@@ -127,7 +126,7 @@ export function MyComponent() {
按钮组件,支持多种变体和尺寸。 按钮组件,支持多种变体和尺寸。
```tsx ```tsx
import { Button } from '@/design-system/base/button/button'; import { Button } from '@/design-system/base/button';
<Button variant="primary" size="md" onClick={handleClick}> <Button variant="primary" size="md" onClick={handleClick}>
点击我 点击我
@@ -145,7 +144,7 @@ import { Button } from '@/design-system/base/button/button';
输入框组件。 输入框组件。
```tsx ```tsx
import { Input } from '@/design-system/base/input/input'; import { Input } from '@/design-system/base/input';
<Input <Input
variant="bordered" variant="bordered"
@@ -163,7 +162,7 @@ import { Input } from '@/design-system/base/input/input';
多行文本输入组件。 多行文本输入组件。
```tsx ```tsx
import { Textarea } from '@/design-system/base/textarea/textarea'; import { Textarea } from '@/design-system/base/textarea';
<Textarea <Textarea
variant="bordered" variant="bordered"
@@ -179,7 +178,7 @@ import { Textarea } from '@/design-system/base/textarea/textarea';
卡片容器组件。 卡片容器组件。
```tsx ```tsx
import { Card, CardHeader, CardTitle, CardBody, CardFooter } from '@/design-system/base/card/card'; import { Card, CardHeader, CardTitle, CardBody, CardFooter } from '@/design-system/base/card';
<Card> <Card>
<CardHeader> <CardHeader>
@@ -203,7 +202,7 @@ import { Card, CardHeader, CardTitle, CardBody, CardFooter } from '@/design-syst
复选框组件。 复选框组件。
```tsx ```tsx
import { Checkbox } from '@/design-system/base/checkbox/checkbox'; import { Checkbox } from '@/design-system/base/checkbox';
<Checkbox checked={checked} onChange={setChecked}> <Checkbox checked={checked} onChange={setChecked}>
同意条款 同意条款
@@ -215,7 +214,7 @@ import { Checkbox } from '@/design-system/base/checkbox/checkbox';
单选按钮组件。 单选按钮组件。
```tsx ```tsx
import { Radio, RadioGroup } from '@/design-system/base/radio/radio'; import { Radio, RadioGroup } from '@/design-system/base/radio';
<RadioGroup name="choice" value={value} onChange={setValue}> <RadioGroup name="choice" value={value} onChange={setValue}>
<Radio value="1">选项 1</Radio> <Radio value="1">选项 1</Radio>
@@ -228,7 +227,7 @@ import { Radio, RadioGroup } from '@/design-system/base/radio/radio';
开关组件。 开关组件。
```tsx ```tsx
import { Switch } from '@/design-system/base/switch/switch'; import { Switch } from '@/design-system/base/switch';
<Switch checked={enabled} onChange={setEnabled} /> <Switch checked={enabled} onChange={setEnabled} />
``` ```
@@ -238,7 +237,7 @@ import { Switch } from '@/design-system/base/switch/switch';
警告提示组件。 警告提示组件。
```tsx ```tsx
import { Alert } from '@/design-system/feedback/alert/alert'; import { Alert } from '@/design-system/feedback/alert';
<Alert variant="success" title="成功"> <Alert variant="success" title="成功">
操作成功完成 操作成功完成
@@ -252,7 +251,7 @@ import { Alert } from '@/design-system/feedback/alert/alert';
进度条组件。 进度条组件。
```tsx ```tsx
import { Progress } from '@/design-system/feedback/progress/progress'; import { Progress } from '@/design-system/feedback/progress';
<Progress value={60} showLabel /> <Progress value={60} showLabel />
``` ```
@@ -262,7 +261,7 @@ import { Progress } from '@/design-system/feedback/progress/progress';
骨架屏组件。 骨架屏组件。
```tsx ```tsx
import { Skeleton, TextSkeleton, CardSkeleton } from '@/design-system/feedback/skeleton/skeleton'; import { Skeleton, TextSkeleton, CardSkeleton } from '@/design-system/feedback/skeleton';
<Skeleton className="h-4 w-32" /> <Skeleton className="h-4 w-32" />
<TextSkeleton lines={3} /> <TextSkeleton lines={3} />
@@ -274,7 +273,7 @@ import { Skeleton, TextSkeleton, CardSkeleton } from '@/design-system/feedback/s
通知提示组件(基于 sonner 通知提示组件(基于 sonner
```tsx ```tsx
import { toast } from '@/design-system/feedback/toast/toast'; import { toast } from '@/design-system/feedback/toast';
toast.success("操作成功!"); toast.success("操作成功!");
toast.error("发生错误"); toast.error("发生错误");
@@ -290,7 +289,7 @@ toast.promise(promise, {
模态框组件。 模态框组件。
```tsx ```tsx
import { Modal } from '@/design-system/overlay/modal/modal'; import { Modal } from '@/design-system/overlay/modal';
<Modal open={open} onClose={() => setOpen(false)}> <Modal open={open} onClose={() => setOpen(false)}>
<Modal.Header> <Modal.Header>
@@ -313,7 +312,7 @@ import { Modal } from '@/design-system/overlay/modal/modal';
徽章组件。 徽章组件。
```tsx ```tsx
import { Badge } from '@/design-system/data-display/badge/badge'; import { Badge } from '@/design-system/data-display/badge';
<Badge variant="success">成功</Badge> <Badge variant="success">成功</Badge>
<Badge dot /> <Badge dot />
@@ -326,7 +325,7 @@ import { Badge } from '@/design-system/data-display/badge/badge';
分隔线组件。 分隔线组件。
```tsx ```tsx
import { Divider } from '@/design-system/data-display/divider/divider'; import { Divider } from '@/design-system/data-display/divider';
<Divider /> <Divider />
<Divider>或者</Divider> <Divider>或者</Divider>
@@ -338,7 +337,7 @@ import { Divider } from '@/design-system/data-display/divider/divider';
容器组件。 容器组件。
```tsx ```tsx
import { Container } from '@/design-system/layout/container/container'; import { Container } from '@/design-system/layout/container';
<Container size="lg" padding="xl"> <Container size="lg" padding="xl">
<p>内容</p> <p>内容</p>
@@ -350,7 +349,7 @@ import { Container } from '@/design-system/layout/container/container';
网格布局组件。 网格布局组件。
```tsx ```tsx
import { Grid } from '@/design-system/layout/grid/grid'; import { Grid } from '@/design-system/layout/grid';
<Grid cols={3} gap={4}> <Grid cols={3} gap={4}>
<div>项目 1</div> <div>项目 1</div>
@@ -364,7 +363,7 @@ import { Grid } from '@/design-system/layout/grid/grid';
堆叠布局组件。 堆叠布局组件。
```tsx ```tsx
import { Stack, VStack, HStack } from '@/design-system/layout/stack/stack'; import { Stack, VStack, HStack } from '@/design-system/layout/stack';
<VStack gap={4}> <VStack gap={4}>
<div>项目 1</div> <div>项目 1</div>
@@ -377,7 +376,7 @@ import { Stack, VStack, HStack } from '@/design-system/layout/stack/stack';
标签页组件。 标签页组件。
```tsx ```tsx
import { Tabs } from '@/design-system/navigation/tabs/tabs'; import { Tabs } from '@/design-system/navigation/tabs';
<Tabs value={activeTab} onValueChange={setActiveTab}> <Tabs value={activeTab} onValueChange={setActiveTab}>
<Tabs.List> <Tabs.List>
@@ -467,9 +466,9 @@ const className = cn(
```tsx ```tsx
// ✅ 使用显式导入 // ✅ 使用显式导入
import { Button } from '@/design-system/base/button/button'; import { Button } from '@/design-system/base/button';
import { Input } from '@/design-system/base/input/input'; import { Input } from '@/design-system/base/input';
import { Card } from '@/design-system/base/card/card'; import { Card } from '@/design-system/base/card';
``` ```
### 2. 样式覆盖 ### 2. 样式覆盖
@@ -521,8 +520,8 @@ import { Input } from '@/components/ui/Input';
新的组件路径: 新的组件路径:
```tsx ```tsx
import { Button } from '@/design-system/base/button/button'; import { Button } from '@/design-system/base/button';
import { Input } from '@/design-system/base/input/input'; import { Input } from '@/design-system/base/input';
``` ```
### API 变化 ### API 变化

View File

@@ -9,7 +9,7 @@
* @example * @example
* ```tsx * ```tsx
* import { toast } from '@/design-system/feedback/toast'; * import { toast } from '@/design-system/feedback/toast';
* * ```
* // 基础用法 * // 基础用法
* toast.success("操作成功!"); * toast.success("操作成功!");
* toast.error("发生错误"); * toast.error("发生错误");