feat: add edit action sticky

This commit is contained in:
moonrailgun 2023-11-15 00:35:13 +08:00
parent 162bec86d5
commit 10398272c1

View File

@ -8,6 +8,7 @@ import { Button, Empty, message } from 'antd';
import { DateFilter } from '../DateFilter'; import { DateFilter } from '../DateFilter';
import { trpc } from '../../api/trpc'; import { trpc } from '../../api/trpc';
import { useCurrentWorkspace, useCurrentWorkspaceId } from '../../store/user'; import { useCurrentWorkspace, useCurrentWorkspaceId } from '../../store/user';
import clsx from 'clsx';
export const Dashboard: React.FC = React.memo(() => { export const Dashboard: React.FC = React.memo(() => {
const { isEditMode, switchEditMode, layouts, items } = useDashboardStore(); const { isEditMode, switchEditMode, layouts, items } = useDashboardStore();
@ -46,7 +47,12 @@ export const Dashboard: React.FC = React.memo(() => {
return ( return (
<div className="py-4"> <div className="py-4">
<div className="flex gap-2 justify-end"> <div
className={clsx(
'flex gap-2 justify-end bg-white py-2',
isEditMode && 'sticky top-0 z-10'
)}
>
{isEditMode ? ( {isEditMode ? (
<> <>
<DashboardItemAddButton /> <DashboardItemAddButton />