fix(ui): 统一表格筛选分页和用量明细,升级 ESLint
This commit is contained in:
@@ -24,6 +24,27 @@ import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import { ConsoleCard, ConsoleSearchBar } from './ConsolePrimitives';
|
||||
import { TableTitle } from '../common/table/TableToolbar';
|
||||
|
||||
export function ConsoleCollectionSearch({ children, className }) {
|
||||
const { t } = useTranslation();
|
||||
const isMobile = useIsMobile();
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
return (
|
||||
<>
|
||||
{isMobile && (
|
||||
<Button
|
||||
onClick={() => setExpanded((value) => !value)}
|
||||
aria-expanded={expanded}
|
||||
>
|
||||
{t(expanded ? '隐藏操作项' : '显示操作项')}
|
||||
</Button>
|
||||
)}
|
||||
<ConsoleSearchBar className={className} hidden={isMobile && !expanded}>
|
||||
{children}
|
||||
</ConsoleSearchBar>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ConsoleCollection({
|
||||
children,
|
||||
statsArea,
|
||||
@@ -36,27 +57,13 @@ export default function ConsoleCollection({
|
||||
tableActionsOffset = false,
|
||||
paginationArea,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const isMobile = useIsMobile();
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const showSearch = !isMobile || expanded;
|
||||
return (
|
||||
<div className='console-collection'>
|
||||
{statsArea && (
|
||||
<ConsoleCard className='console-stats'>{statsArea}</ConsoleCard>
|
||||
)}
|
||||
{searchArea && (
|
||||
<>
|
||||
{isMobile && (
|
||||
<Button
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
aria-expanded={expanded}
|
||||
>
|
||||
{t(expanded ? '隐藏操作项' : '显示操作项')}
|
||||
</Button>
|
||||
)}
|
||||
<ConsoleSearchBar hidden={!showSearch}>{searchArea}</ConsoleSearchBar>
|
||||
</>
|
||||
<ConsoleCollectionSearch>{searchArea}</ConsoleCollectionSearch>
|
||||
)}
|
||||
<ConsoleCard>
|
||||
{tabsArea && <div className='console-list-tabs'>{tabsArea}</div>}
|
||||
|
||||
Reference in New Issue
Block a user