flatten folder design-system
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
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 { repoGetFoldersWithTotalPairsByUserId } from "@/modules/folder/folder-repository";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { PageLayout } from "@/components/ui/PageLayout";
|
||||
import { Card } from "@/design-system/base/card/card";
|
||||
import { Card } from "@/design-system/base/card";
|
||||
|
||||
interface AlphabetCardProps {
|
||||
alphabet: Letter[];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LightButton } from "@/design-system/base/button/button";
|
||||
import { IconClick } from "@/design-system/base/button/button";
|
||||
import { LightButton } from "@/design-system/base/button";
|
||||
import { IconClick } from "@/design-system/base/button";
|
||||
import { IMAGES } from "@/config/images";
|
||||
import { Letter, SupportedAlphabets } from "@/lib/interfaces";
|
||||
import {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useState, useEffect } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Letter, SupportedAlphabets } from "@/lib/interfaces";
|
||||
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";
|
||||
|
||||
export default function Alphabet() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { LightButton } from "@/design-system/base/button/button";
|
||||
import { Input } from "@/design-system/base/input/input";
|
||||
import { LightButton } from "@/design-system/base/button";
|
||||
import { Input } from "@/design-system/base/input";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
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 { actionCreatePair } from "@/modules/folder/folder-aciton";
|
||||
import { TSharedItem } from "@/shared/dictionary-type";
|
||||
|
||||
@@ -6,7 +6,7 @@ import Link from "next/link";
|
||||
import { Folder as Fd } from "lucide-react";
|
||||
import { TSharedFolderWithTotalPairs } from "@/shared/folder-type";
|
||||
import { PageLayout } from "@/components/ui/PageLayout";
|
||||
import { PrimaryButton } from "@/design-system/base/button/button";
|
||||
import { PrimaryButton } from "@/design-system/base/button";
|
||||
|
||||
interface FolderSelectorProps {
|
||||
folders: TSharedFolderWithTotalPairs[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
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 { getTTSUrl, TTS_SUPPORTED_LANGUAGES } from "@/lib/bigmodel/tts";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useRef, forwardRef, useEffect, useCallback } from "react";
|
||||
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 { getIndex, parseSrt, getNearistIndex } from "../subtitle";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
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";
|
||||
|
||||
interface FileInputComponentProps extends FileInputProps {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import React from "react";
|
||||
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";
|
||||
|
||||
export function PlayButton({ isPlaying, onToggle, disabled, className }: PlayButtonProps) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
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 { getPlaybackRateOptions, getPlaybackRateLabel } from "../../utils/timeUtils";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import React from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 { PlayButton } from "../atoms/PlayButton";
|
||||
import { SpeedControl } from "../atoms/SpeedControl";
|
||||
|
||||
@@ -4,7 +4,7 @@ import React from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { toast } from "sonner";
|
||||
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 { useFileUpload } from "../../hooks/useFileUpload";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { SubtitleArea } from "./components/compounds/SubtitleArea";
|
||||
import { ControlBar } from "./components/compounds/ControlBar";
|
||||
import { UploadZone } from "./components/compounds/UploadZone";
|
||||
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() {
|
||||
const t = useTranslations("home");
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
TextSpeakerArraySchema,
|
||||
TextSpeakerItemSchema,
|
||||
} from "@/lib/interfaces";
|
||||
import { IconClick } from "@/design-system/base/button/button";
|
||||
import { IconClick } from "@/design-system/base/button";
|
||||
import { IMAGES } from "@/config/images";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { getLocalStorageOperator } from "@/lib/browser/localStorageOperators";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { LightButton } from "@/design-system/base/button/button";
|
||||
import { IconClick } from "@/design-system/base/button/button";
|
||||
import { LightButton } from "@/design-system/base/button";
|
||||
import { IconClick } from "@/design-system/base/button";
|
||||
import { IMAGES } from "@/config/images";
|
||||
import { useAudioPlayer } from "@/hooks/useAudioPlayer";
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"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 { useAudioPlayer } from "@/hooks/useAudioPlayer";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
FolderPlus,
|
||||
Trash2,
|
||||
} 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 { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LightButton } from "@/design-system/base/button/button";
|
||||
import { Input } from "@/design-system/base/input/input";
|
||||
import { LightButton } from "@/design-system/base/button";
|
||||
import { Input } from "@/design-system/base/input";
|
||||
import { LocaleSelector } from "@/components/ui/LocaleSelector";
|
||||
import { X } from "lucide-react";
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
@@ -7,7 +7,7 @@ import { AddTextPairModal } from "./AddTextPairModal";
|
||||
import { TextPairCard } from "./TextPairCard";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 { actionCreatePair, actionDeletePairById, actionGetPairsByFolderId } from "@/modules/folder/folder-aciton";
|
||||
import { TSharedPair } from "@/shared/folder-type";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Edit, Trash2 } from "lucide-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 { useTranslations } from "next-intl";
|
||||
import { TSharedPair } from "@/shared/folder-type";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LightButton } from "@/design-system/base/button/button";
|
||||
import { Input } from "@/design-system/base/input/input";
|
||||
import { LightButton } from "@/design-system/base/button";
|
||||
import { Input } from "@/design-system/base/input";
|
||||
import { LocaleSelector } from "@/components/ui/LocaleSelector";
|
||||
import { X } from "lucide-react";
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { GhostLightButton } from "@/design-system/base/button/button";
|
||||
import { GhostLightButton } from "@/design-system/base/button";
|
||||
import { useState } from "react";
|
||||
import { Languages } from "lucide-react";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { LanguageSettings } from "./LanguageSettings";
|
||||
import { auth } from "@/auth";
|
||||
import { headers } from "next/headers";
|
||||
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() {
|
||||
const t = await getTranslations("navbar");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* 使用 Design System 重写的卡片列表组件
|
||||
*/
|
||||
import { VStack } from "@/design-system/layout/stack/stack";
|
||||
import { VStack } from "@/design-system/layout/stack";
|
||||
|
||||
interface CardListProps {
|
||||
children: React.ReactNode;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* 使用 Design System 重写的容器组件
|
||||
*/
|
||||
import { Container as DSContainer } from "@/design-system/layout/container/container";
|
||||
import { Card } from "@/design-system/base/card/card";
|
||||
import { Container as DSContainer } from "@/design-system/layout/container";
|
||||
import { Card } from "@/design-system/base/card";
|
||||
|
||||
interface ContainerProps {
|
||||
children?: React.ReactNode;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Input } from "@/design-system/base/input/input";
|
||||
import { Select } from "@/design-system/base/select/select";
|
||||
import { VStack } from "@/design-system/layout/stack/stack";
|
||||
import { Input } from "@/design-system/base/input";
|
||||
import { Select } from "@/design-system/base/select";
|
||||
import { VStack } from "@/design-system/layout/stack";
|
||||
|
||||
const COMMON_LANGUAGES = [
|
||||
{ label: "chinese", value: "chinese" },
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* 使用 Design System 重写的页面标题组件
|
||||
*/
|
||||
import { VStack } from "@/design-system/layout/stack/stack";
|
||||
import { VStack } from "@/design-system/layout/stack";
|
||||
|
||||
interface PageHeaderProps {
|
||||
title: string;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* 使用 Design System 重写的页面布局组件
|
||||
*/
|
||||
import { Card } from "@/design-system/base/card/card";
|
||||
import { Container } from "@/design-system/layout/container/container";
|
||||
import { Card } from "@/design-system/base/card";
|
||||
import { Container } from "@/design-system/layout/container";
|
||||
|
||||
type PageLayoutVariant = "centered-card" | "full-width" | "fullscreen";
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// 可以从 '@/components/ui' 导入所有组件
|
||||
|
||||
// Design System 组件(向后兼容)
|
||||
export { Input, type InputVariant, type InputProps } from '@/design-system/base/input/input';
|
||||
export { Select, type SelectVariant, type SelectSize, type SelectProps } from '@/design-system/base/select/select';
|
||||
export { Textarea, type TextareaVariant, type TextareaProps } from '@/design-system/base/textarea/textarea';
|
||||
export { Card, type CardVariant, type CardPadding, type CardProps } from '@/design-system/base/card/card';
|
||||
export { Input, type InputVariant, type InputProps } from '@/design-system/base/input';
|
||||
export { Select, type SelectVariant, type SelectSize, type SelectProps } from '@/design-system/base/select';
|
||||
export { Textarea, type TextareaVariant, type TextareaProps } from '@/design-system/base/textarea';
|
||||
export { Card, type CardVariant, type CardPadding, type CardProps } from '@/design-system/base/card';
|
||||
export {
|
||||
Button,
|
||||
PrimaryButton,
|
||||
@@ -18,7 +18,7 @@ export {
|
||||
type ButtonVariant,
|
||||
type ButtonSize,
|
||||
type ButtonProps
|
||||
} from '@/design-system/base/button/button';
|
||||
} from '@/design-system/base/button';
|
||||
|
||||
// 业务特定组件
|
||||
export { RangeInput } from './RangeInput';
|
||||
|
||||
@@ -6,33 +6,32 @@
|
||||
|
||||
```
|
||||
src/design-system/
|
||||
├── tokens/ # 设计令牌(颜色、间距、字体等)
|
||||
├── lib/ # 工具函数
|
||||
├── base/ # 基础组件
|
||||
│ ├── button/
|
||||
│ ├── input/
|
||||
│ ├── textarea/
|
||||
│ ├── card/
|
||||
│ ├── checkbox/
|
||||
│ ├── radio/
|
||||
│ ├── switch/
|
||||
│ └── select/
|
||||
│ ├── button.tsx
|
||||
│ ├── input.tsx
|
||||
│ ├── textarea.tsx
|
||||
│ ├── card.tsx
|
||||
│ ├── checkbox.tsx
|
||||
│ ├── radio.tsx
|
||||
│ ├── switch.tsx
|
||||
│ └── select.tsx
|
||||
├── feedback/ # 反馈组件
|
||||
│ ├── alert/
|
||||
│ ├── progress/
|
||||
│ ├── skeleton/
|
||||
│ └── toast/
|
||||
│ ├── alert.tsx
|
||||
│ ├── progress.tsx
|
||||
│ ├── skeleton.tsx
|
||||
│ └── toast.tsx
|
||||
├── overlay/ # 覆盖组件
|
||||
│ └── modal/
|
||||
│ └── modal.tsx
|
||||
├── data-display/ # 数据展示组件
|
||||
│ ├── badge/
|
||||
│ └── divider/
|
||||
│ ├── badge.tsx
|
||||
│ └── divider.tsx
|
||||
├── layout/ # 布局组件
|
||||
│ ├── container/
|
||||
│ ├── grid/
|
||||
│ └── stack/
|
||||
├── navigation/ # 导航组件
|
||||
│ └── tabs/
|
||||
│ ├── container.tsx
|
||||
│ ├── grid.tsx
|
||||
│ └── stack.tsx
|
||||
└── navigation/ # 导航组件
|
||||
└── tabs.tsx
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
@@ -47,16 +46,16 @@ pnpm add class-variance-authority clsx tailwind-merge
|
||||
|
||||
```tsx
|
||||
// 使用显式导入以获得更好的 tree-shaking
|
||||
import { Button } from '@/design-system/base/button/button';
|
||||
import { Input } from '@/design-system/base/input/input';
|
||||
import { Card } from '@/design-system/base/card/card';
|
||||
import { Button } from '@/design-system/base/button';
|
||||
import { Input } from '@/design-system/base/input';
|
||||
import { Card } from '@/design-system/base/card';
|
||||
```
|
||||
|
||||
### 使用组件
|
||||
|
||||
```tsx
|
||||
import { Button } from '@/design-system/base/button/button';
|
||||
import { Card } from '@/design-system/base/card/card';
|
||||
import { Button } from '@/design-system/base/button';
|
||||
import { Card } from '@/design-system/base/card';
|
||||
|
||||
export function MyComponent() {
|
||||
return (
|
||||
@@ -127,7 +126,7 @@ export function MyComponent() {
|
||||
按钮组件,支持多种变体和尺寸。
|
||||
|
||||
```tsx
|
||||
import { Button } from '@/design-system/base/button/button';
|
||||
import { Button } from '@/design-system/base/button';
|
||||
|
||||
<Button variant="primary" size="md" onClick={handleClick}>
|
||||
点击我
|
||||
@@ -145,7 +144,7 @@ import { Button } from '@/design-system/base/button/button';
|
||||
输入框组件。
|
||||
|
||||
```tsx
|
||||
import { Input } from '@/design-system/base/input/input';
|
||||
import { Input } from '@/design-system/base/input';
|
||||
|
||||
<Input
|
||||
variant="bordered"
|
||||
@@ -163,7 +162,7 @@ import { Input } from '@/design-system/base/input/input';
|
||||
多行文本输入组件。
|
||||
|
||||
```tsx
|
||||
import { Textarea } from '@/design-system/base/textarea/textarea';
|
||||
import { Textarea } from '@/design-system/base/textarea';
|
||||
|
||||
<Textarea
|
||||
variant="bordered"
|
||||
@@ -179,7 +178,7 @@ import { Textarea } from '@/design-system/base/textarea/textarea';
|
||||
卡片容器组件。
|
||||
|
||||
```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>
|
||||
<CardHeader>
|
||||
@@ -203,7 +202,7 @@ import { Card, CardHeader, CardTitle, CardBody, CardFooter } from '@/design-syst
|
||||
复选框组件。
|
||||
|
||||
```tsx
|
||||
import { Checkbox } from '@/design-system/base/checkbox/checkbox';
|
||||
import { Checkbox } from '@/design-system/base/checkbox';
|
||||
|
||||
<Checkbox checked={checked} onChange={setChecked}>
|
||||
同意条款
|
||||
@@ -215,7 +214,7 @@ import { Checkbox } from '@/design-system/base/checkbox/checkbox';
|
||||
单选按钮组件。
|
||||
|
||||
```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}>
|
||||
<Radio value="1">选项 1</Radio>
|
||||
@@ -228,7 +227,7 @@ import { Radio, RadioGroup } from '@/design-system/base/radio/radio';
|
||||
开关组件。
|
||||
|
||||
```tsx
|
||||
import { Switch } from '@/design-system/base/switch/switch';
|
||||
import { Switch } from '@/design-system/base/switch';
|
||||
|
||||
<Switch checked={enabled} onChange={setEnabled} />
|
||||
```
|
||||
@@ -238,7 +237,7 @@ import { Switch } from '@/design-system/base/switch/switch';
|
||||
警告提示组件。
|
||||
|
||||
```tsx
|
||||
import { Alert } from '@/design-system/feedback/alert/alert';
|
||||
import { Alert } from '@/design-system/feedback/alert';
|
||||
|
||||
<Alert variant="success" title="成功">
|
||||
操作成功完成
|
||||
@@ -252,7 +251,7 @@ import { Alert } from '@/design-system/feedback/alert/alert';
|
||||
进度条组件。
|
||||
|
||||
```tsx
|
||||
import { Progress } from '@/design-system/feedback/progress/progress';
|
||||
import { Progress } from '@/design-system/feedback/progress';
|
||||
|
||||
<Progress value={60} showLabel />
|
||||
```
|
||||
@@ -262,7 +261,7 @@ import { Progress } from '@/design-system/feedback/progress/progress';
|
||||
骨架屏组件。
|
||||
|
||||
```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" />
|
||||
<TextSkeleton lines={3} />
|
||||
@@ -274,7 +273,7 @@ import { Skeleton, TextSkeleton, CardSkeleton } from '@/design-system/feedback/s
|
||||
通知提示组件(基于 sonner)。
|
||||
|
||||
```tsx
|
||||
import { toast } from '@/design-system/feedback/toast/toast';
|
||||
import { toast } from '@/design-system/feedback/toast';
|
||||
|
||||
toast.success("操作成功!");
|
||||
toast.error("发生错误");
|
||||
@@ -290,7 +289,7 @@ toast.promise(promise, {
|
||||
模态框组件。
|
||||
|
||||
```tsx
|
||||
import { Modal } from '@/design-system/overlay/modal/modal';
|
||||
import { Modal } from '@/design-system/overlay/modal';
|
||||
|
||||
<Modal open={open} onClose={() => setOpen(false)}>
|
||||
<Modal.Header>
|
||||
@@ -313,7 +312,7 @@ import { Modal } from '@/design-system/overlay/modal/modal';
|
||||
徽章组件。
|
||||
|
||||
```tsx
|
||||
import { Badge } from '@/design-system/data-display/badge/badge';
|
||||
import { Badge } from '@/design-system/data-display/badge';
|
||||
|
||||
<Badge variant="success">成功</Badge>
|
||||
<Badge dot />
|
||||
@@ -326,7 +325,7 @@ import { Badge } from '@/design-system/data-display/badge/badge';
|
||||
分隔线组件。
|
||||
|
||||
```tsx
|
||||
import { Divider } from '@/design-system/data-display/divider/divider';
|
||||
import { Divider } from '@/design-system/data-display/divider';
|
||||
|
||||
<Divider />
|
||||
<Divider>或者</Divider>
|
||||
@@ -338,7 +337,7 @@ import { Divider } from '@/design-system/data-display/divider/divider';
|
||||
容器组件。
|
||||
|
||||
```tsx
|
||||
import { Container } from '@/design-system/layout/container/container';
|
||||
import { Container } from '@/design-system/layout/container';
|
||||
|
||||
<Container size="lg" padding="xl">
|
||||
<p>内容</p>
|
||||
@@ -350,7 +349,7 @@ import { Container } from '@/design-system/layout/container/container';
|
||||
网格布局组件。
|
||||
|
||||
```tsx
|
||||
import { Grid } from '@/design-system/layout/grid/grid';
|
||||
import { Grid } from '@/design-system/layout/grid';
|
||||
|
||||
<Grid cols={3} gap={4}>
|
||||
<div>项目 1</div>
|
||||
@@ -364,7 +363,7 @@ import { Grid } from '@/design-system/layout/grid/grid';
|
||||
堆叠布局组件。
|
||||
|
||||
```tsx
|
||||
import { Stack, VStack, HStack } from '@/design-system/layout/stack/stack';
|
||||
import { Stack, VStack, HStack } from '@/design-system/layout/stack';
|
||||
|
||||
<VStack gap={4}>
|
||||
<div>项目 1</div>
|
||||
@@ -377,7 +376,7 @@ import { Stack, VStack, HStack } from '@/design-system/layout/stack/stack';
|
||||
标签页组件。
|
||||
|
||||
```tsx
|
||||
import { Tabs } from '@/design-system/navigation/tabs/tabs';
|
||||
import { Tabs } from '@/design-system/navigation/tabs';
|
||||
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab}>
|
||||
<Tabs.List>
|
||||
@@ -467,9 +466,9 @@ const className = cn(
|
||||
|
||||
```tsx
|
||||
// ✅ 使用显式导入
|
||||
import { Button } from '@/design-system/base/button/button';
|
||||
import { Input } from '@/design-system/base/input/input';
|
||||
import { Card } from '@/design-system/base/card/card';
|
||||
import { Button } from '@/design-system/base/button';
|
||||
import { Input } from '@/design-system/base/input';
|
||||
import { Card } from '@/design-system/base/card';
|
||||
```
|
||||
|
||||
### 2. 样式覆盖
|
||||
@@ -521,8 +520,8 @@ import { Input } from '@/components/ui/Input';
|
||||
新的组件路径:
|
||||
|
||||
```tsx
|
||||
import { Button } from '@/design-system/base/button/button';
|
||||
import { Input } from '@/design-system/base/input/input';
|
||||
import { Button } from '@/design-system/base/button';
|
||||
import { Input } from '@/design-system/base/input';
|
||||
```
|
||||
|
||||
### API 变化
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* @example
|
||||
* ```tsx
|
||||
* import { toast } from '@/design-system/feedback/toast';
|
||||
*
|
||||
* ```
|
||||
* // 基础用法
|
||||
* toast.success("操作成功!");
|
||||
* toast.error("发生错误");
|
||||
Reference in New Issue
Block a user