-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: pro table * refactor: splitting components * chore: use workspace typescript * feat(proTable): add storybook * fix(storybook): preview width * feat(storybook): light and dark mode * fix: height * style: pagination style * feat: support search * feat(ProTable): search form filed * feat(ProTable): column pinning sticky * feat(ProTable): pinned TypeScript * chore: remove function * fix: vitepress build * feat(proTable stories): reorganize ProTable stories for better clarity - Split stories into individual feature demonstrations - Add basic table example with simplified data structure - Add separate stories for pagination, loading, empty state - Add stories for search, custom toolbar, pinned columns - Add stories for custom column sizes and visibility - Add stories for refresh functionality and custom cells - Improve code organization and readability - Fix linting issues with console statements and spacing * feat(proTable): split table body * feat(proTable): split stories * chore: upgrade storybook * feat: split ProTable into dataTable * feat: fetch data * feat(data table): option * fix(data table): search options * chore: rename data-table-search * chore: remove TeamSwitcher * fix: preset value * chore: api * fix: pagination * feat(data table): when change page size, reset page index to 0 * chore: cSpell * feat: avatars
- Loading branch information
Showing
67 changed files
with
2,735 additions
and
2,229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { addons } from "@storybook/manager-api" | ||
import { Moon, Sun } from "lucide-react" | ||
import * as React from "react" | ||
|
||
import { useTheme } from "../src/components/theme/theme-provider" | ||
import { Button } from "../src/components/ui/button" | ||
import { darkTheme, lightTheme } from "./theme" | ||
|
||
export function ThemeChanger() { | ||
const { theme, setTheme } = useTheme() | ||
|
||
React.useEffect(() => { | ||
// 初始化时设置 Storybook 主题 | ||
addons.setConfig({ | ||
theme: theme === "dark" ? darkTheme : lightTheme, | ||
}) | ||
}, []) | ||
|
||
const toggleTheme = React.useCallback(() => { | ||
const newTheme = theme === "dark" ? "light" : "dark" | ||
setTheme(newTheme) | ||
|
||
// 更新 Storybook 管理界面主题 | ||
addons.setConfig({ | ||
theme: newTheme === "dark" ? darkTheme : lightTheme, | ||
}) | ||
}, [theme, setTheme]) | ||
|
||
return ( | ||
<Button | ||
variant="outline" | ||
size="icon" | ||
className="fixed right-4 top-4 z-50" | ||
onClick={toggleTheme} | ||
> | ||
{theme === "dark" ? ( | ||
<Sun className="size-5" /> | ||
) : ( | ||
<Moon className="size-5" /> | ||
)} | ||
</Button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { addons } from "@storybook/manager-api" | ||
import { themes } from "@storybook/theming" | ||
|
||
// 获取系统主题偏好 | ||
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches | ||
|
||
addons.setConfig({ | ||
theme: themes.dark, | ||
theme: prefersDark ? themes.dark : themes.light, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { create } from "@storybook/theming/create" | ||
|
||
export const lightTheme = create({ | ||
base: "light", | ||
brandTitle: "My Storybook", | ||
brandUrl: "/", | ||
|
||
// Colors | ||
colorPrimary: "#0099FF", | ||
colorSecondary: "#0099FF", | ||
|
||
// UI | ||
appBg: "#F6F9FC", | ||
appContentBg: "#FFFFFF", | ||
appBorderColor: "rgba(0,0,0,.1)", | ||
appBorderRadius: 4, | ||
|
||
// Text colors | ||
textColor: "#333333", | ||
textInverseColor: "#FFFFFF", | ||
|
||
// Toolbar default and active colors | ||
barTextColor: "#999999", | ||
barSelectedColor: "#0099FF", | ||
barBg: "#FFFFFF", | ||
|
||
// Form colors | ||
inputBg: "#FFFFFF", | ||
inputBorder: "rgba(0,0,0,.1)", | ||
inputTextColor: "#333333", | ||
inputBorderRadius: 4, | ||
}) | ||
|
||
export const darkTheme = create({ | ||
base: "dark", | ||
brandTitle: "My Storybook", | ||
brandUrl: "/", | ||
|
||
// Colors | ||
colorPrimary: "#0099FF", | ||
colorSecondary: "#0099FF", | ||
|
||
// UI | ||
appBg: "#1b1b1b", | ||
appContentBg: "#262626", | ||
appBorderColor: "rgba(255,255,255,.1)", | ||
appBorderRadius: 4, | ||
|
||
// Text colors | ||
textColor: "#FFFFFF", | ||
textInverseColor: "#333333", | ||
|
||
// Toolbar default and active colors | ||
barTextColor: "#999999", | ||
barSelectedColor: "#0099FF", | ||
barBg: "#1b1b1b", | ||
|
||
// Form colors | ||
inputBg: "#333333", | ||
inputBorder: "rgba(255,255,255,.1)", | ||
inputTextColor: "#FFFFFF", | ||
inputBorderRadius: 4, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.