feat(web): 增加动效插件并优化侧边栏动画

- 为 `web` 应用引入 `tailwindcss-animate`,并接入 Tailwind 配置。
- 调整 `sheet` 与 `sidebar` 的移动端遮罩、过渡时长和动画曲线,提升侧边栏展开收起体验。
- 精简移动端侧边栏无障碍标题,仅保留必要语义。
This commit is contained in:
LanQin
2026-06-20 02:26:45 +08:00
parent 4dd843b50a
commit 6d0935c6a5
5 changed files with 17 additions and 6 deletions
+1
View File
@@ -57,6 +57,7 @@
"autoprefixer": "10.4.20", "autoprefixer": "10.4.20",
"postcss": "8.5.15", "postcss": "8.5.15",
"tailwindcss": "3.4.15", "tailwindcss": "3.4.15",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.6.3", "typescript": "5.6.3",
"vite": "8.0.16" "vite": "8.0.16"
} }
+2 -2
View File
@@ -19,7 +19,7 @@ const SheetOverlay = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<SheetPrimitive.Overlay <SheetPrimitive.Overlay
className={cn( className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "fixed inset-0 z-50 bg-black/35 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:duration-150 data-[state=open]:duration-200 sm:bg-black/45",
className className
)} )}
{...props} {...props}
@@ -29,7 +29,7 @@ const SheetOverlay = React.forwardRef<
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
const sheetVariants = cva( const sheetVariants = cva(
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out", "fixed z-50 gap-4 bg-background p-6 shadow-lg will-change-transform data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-150 data-[state=open]:duration-200 data-[state=closed]:ease-in data-[state=open]:ease-out",
{ {
variants: { variants: {
side: { side: {
+1 -3
View File
@@ -11,7 +11,6 @@ import { Separator } from "@/components/ui/separator"
import { import {
Sheet, Sheet,
SheetContent, SheetContent,
SheetDescription,
SheetHeader, SheetHeader,
SheetTitle, SheetTitle,
} from "@/components/ui/sheet" } from "@/components/ui/sheet"
@@ -211,8 +210,7 @@ const Sidebar = React.forwardRef<
side={side} side={side}
> >
<SheetHeader className="sr-only"> <SheetHeader className="sr-only">
<SheetTitle>Sidebar</SheetTitle> <SheetTitle></SheetTitle>
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
</SheetHeader> </SheetHeader>
<div className="flex h-full w-full flex-col">{children}</div> <div className="flex h-full w-full flex-col">{children}</div>
</SheetContent> </SheetContent>
+1 -1
View File
@@ -56,5 +56,5 @@ module.exports = {
} }
} }
}, },
plugins: [], plugins: [require("tailwindcss-animate")],
} }
+12
View File
@@ -138,6 +138,9 @@ importers:
tailwindcss: tailwindcss:
specifier: 3.4.15 specifier: 3.4.15
version: 3.4.15 version: 3.4.15
tailwindcss-animate:
specifier: ^1.0.7
version: 1.0.7(tailwindcss@3.4.15)
typescript: typescript:
specifier: 5.6.3 specifier: 5.6.3
version: 5.6.3 version: 5.6.3
@@ -1491,6 +1494,11 @@ packages:
tailwind-merge@2.5.4: tailwind-merge@2.5.4:
resolution: {integrity: sha512-0q8cfZHMu9nuYP/b5Shb7Y7Sh1B7Nnl5GqNr1U+n2p6+mybvRtayrQ+0042Z5byvTA8ihjlP8Odo8/VnHbZu4Q==} resolution: {integrity: sha512-0q8cfZHMu9nuYP/b5Shb7Y7Sh1B7Nnl5GqNr1U+n2p6+mybvRtayrQ+0042Z5byvTA8ihjlP8Odo8/VnHbZu4Q==}
tailwindcss-animate@1.0.7:
resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==}
peerDependencies:
tailwindcss: '>=3.0.0 || insiders'
tailwindcss@3.4.15: tailwindcss@3.4.15:
resolution: {integrity: sha512-r4MeXnfBmSOuKUWmXe6h2CcyfzJCEk4F0pptO5jlnYSIViUkVmsawj80N5h2lO3gwcmSb4n3PuN+e+GC1Guylw==} resolution: {integrity: sha512-r4MeXnfBmSOuKUWmXe6h2CcyfzJCEk4F0pptO5jlnYSIViUkVmsawj80N5h2lO3gwcmSb4n3PuN+e+GC1Guylw==}
engines: {node: '>=14.0.0'} engines: {node: '>=14.0.0'}
@@ -2892,6 +2900,10 @@ snapshots:
tailwind-merge@2.5.4: {} tailwind-merge@2.5.4: {}
tailwindcss-animate@1.0.7(tailwindcss@3.4.15):
dependencies:
tailwindcss: 3.4.15
tailwindcss@3.4.15: tailwindcss@3.4.15:
dependencies: dependencies:
'@alloc/quick-lru': 5.2.0 '@alloc/quick-lru': 5.2.0