From eefc51a0c219b129491aaf1660f58019e3a8c664 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Thu, 21 Nov 2024 01:50:46 +0100 Subject: [PATCH] [website] Improve animation speed --- docs/src/components/pricing/PricingTable.tsx | 778 ++++++++++--------- 1 file changed, 400 insertions(+), 378 deletions(-) diff --git a/docs/src/components/pricing/PricingTable.tsx b/docs/src/components/pricing/PricingTable.tsx index 6dd607e3477de8..5afc2add270c1b 100644 --- a/docs/src/components/pricing/PricingTable.tsx +++ b/docs/src/components/pricing/PricingTable.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { alpha, styled } from '@mui/material/styles'; +import { alpha, styled, ThemeProvider } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import Button from '@mui/material/Button'; import Container from '@mui/material/Container'; @@ -42,6 +42,24 @@ function formatCurrency(value: number) { return `$${formatter.format(value)}`; } +// TODO: Collapse should expose an API to customize the duration based on the height. +function transitionTheme(theme: any) { + return { + ...theme, + transitions: { + ...theme.transitions, + getAutoHeightDuration: (height: number) => { + if (!height) { + return 0; + } + + const constant = height / 80; + return Math.round((4 + 15 * constant ** 0.1 + constant / 6) * 10); + }, + }, + }; +} + export function PlanName({ plan, disableDescription = false, @@ -1307,404 +1325,408 @@ export default function PricingTable({ const renderNestedRow = (key: string) => renderMasterRow(key, nestedGridSx, plans); return ( - - - {!columnHeaderHidden && ( - - - Plans - - - - - - - -
- - -
- -
- - - - + + + + {!columnHeaderHidden && ( + + + Plans + + + + + + + +
+ + +
+ +
+ + + + +
-
- )} - }> - MUI Core (open-source) - - {renderRow('Material UI')} - {divider} - {renderRow('Joy UI')} - {divider} - {renderRow('Base UI')} - {divider} - {renderRow('MUI System')} - }> - MUI X (open-core) - - - - {dataGridUnfoldMore} - - {dataGridUnfoldMore} - - - {dataGridUnfoldMore} - - - - - Column features - {renderNestedRow('data-grid/column-groups')} - {divider} - {renderNestedRow('data-grid/column-spanning')} - {divider} - {renderNestedRow('data-grid/column-resizing')} - {divider} - {renderNestedRow('data-grid/column-autosizing')} - {divider} - {renderNestedRow('data-grid/column-reorder')} - {divider} - {renderNestedRow('data-grid/column-pinning')} - {divider} - Row features - {renderNestedRow('data-grid/row-height')} - {divider} - {renderNestedRow('data-grid/row-spanning')} - {divider} - {renderNestedRow('data-grid/row-reordering')} - {divider} - {renderNestedRow('data-grid/row-pinning')} - {divider} - Selection features - {renderNestedRow('data-grid/row-selection')} - {divider} - {renderNestedRow('data-grid/row-multiselection')} - {divider} - {renderNestedRow('data-grid/row-cell-selection')} - {divider} - Filtering features - {renderNestedRow('data-grid/filter-column')} - {divider} - {renderNestedRow('data-grid/filter-quick')} - {divider} - {renderNestedRow('data-grid/header-filters')} - {divider} - {renderNestedRow('data-grid/filter-multicolumn')} - {divider} - Sorting - {renderNestedRow('data-grid/column-sorting')} - {divider} - {renderNestedRow('data-grid/multi-column-sorting')} - {divider} - Pagination features - {renderNestedRow('data-grid/pagination')} - {divider} - {renderNestedRow('data-grid/pagination-large')} - {divider} - Editing features - {renderNestedRow('data-grid/edit-row')} - {divider} - {renderNestedRow('data-grid/edit-cell')} - {divider} - Import & export - {renderNestedRow('data-grid/file-csv')} - {divider} - {renderNestedRow('data-grid/file-print')} - {divider} - {renderNestedRow('data-grid/file-clipboard-copy')} - {divider} - {renderNestedRow('data-grid/file-clipboard-paste')} - {divider} - {renderNestedRow('data-grid/file-excel')} - {divider} - Rendering features - {renderNestedRow('data-grid/customizable-components')} - {divider} - {renderNestedRow('data-grid/virtualize-column')} - {divider} - {renderNestedRow('data-grid/virtualize-row')} - {divider} - Group & pivot - {renderNestedRow('data-grid/tree-data')} - {divider} - {renderNestedRow('data-grid/master-detail')} - {divider} - {renderNestedRow('data-grid/grouping')} - {divider} - {renderNestedRow('data-grid/aggregation')} - {divider} - {renderNestedRow('data-grid/pivoting')} - {divider} - Miscellaneous - {renderNestedRow('data-grid/accessibility')} - {divider} - {renderNestedRow('data-grid/keyboard-nav')} + (theme) => + theme.applyDarkStyles({ + '&:hover': { + bgcolor: alpha(theme.palette.primary.main, 0.06), + }, + }), + ]} + > + Data Grid + +
+ + Column features + {renderNestedRow('data-grid/column-groups')} + {divider} + {renderNestedRow('data-grid/column-spanning')} + {divider} + {renderNestedRow('data-grid/column-resizing')} + {divider} + {renderNestedRow('data-grid/column-autosizing')} + {divider} + {renderNestedRow('data-grid/column-reorder')} + {divider} + {renderNestedRow('data-grid/column-pinning')} + {divider} + Row features + {renderNestedRow('data-grid/row-height')} + {divider} + {renderNestedRow('data-grid/row-spanning')} + {divider} + {renderNestedRow('data-grid/row-reordering')} + {divider} + {renderNestedRow('data-grid/row-pinning')} + {divider} + Selection features + {renderNestedRow('data-grid/row-selection')} + {divider} + {renderNestedRow('data-grid/row-multiselection')} + {divider} + {renderNestedRow('data-grid/row-cell-selection')} + {divider} + Filtering features + {renderNestedRow('data-grid/filter-column')} + {divider} + {renderNestedRow('data-grid/filter-quick')} + {divider} + {renderNestedRow('data-grid/header-filters')} + {divider} + {renderNestedRow('data-grid/filter-multicolumn')} + {divider} + Sorting + {renderNestedRow('data-grid/column-sorting')} + {divider} + {renderNestedRow('data-grid/multi-column-sorting')} + {divider} + Pagination features + {renderNestedRow('data-grid/pagination')} + {divider} + {renderNestedRow('data-grid/pagination-large')} + {divider} + Editing features + {renderNestedRow('data-grid/edit-row')} + {divider} + {renderNestedRow('data-grid/edit-cell')} + {divider} + Import & export + {renderNestedRow('data-grid/file-csv')} + {divider} + {renderNestedRow('data-grid/file-print')} + {divider} + {renderNestedRow('data-grid/file-clipboard-copy')} + {divider} + {renderNestedRow('data-grid/file-clipboard-paste')} + {divider} + {renderNestedRow('data-grid/file-excel')} + {divider} + Rendering features + {renderNestedRow('data-grid/customizable-components')} + {divider} + {renderNestedRow('data-grid/virtualize-column')} + {divider} + {renderNestedRow('data-grid/virtualize-row')} + {divider} + Group & pivot + {renderNestedRow('data-grid/tree-data')} + {divider} + {renderNestedRow('data-grid/master-detail')} + {divider} + {renderNestedRow('data-grid/grouping')} + {divider} + {renderNestedRow('data-grid/aggregation')} + {divider} + {renderNestedRow('data-grid/pivoting')} + {divider} + Miscellaneous + {renderNestedRow('data-grid/accessibility')} + {divider} + {renderNestedRow('data-grid/keyboard-nav')} + {divider} + {renderNestedRow('data-grid/localization')} + + {divider} + {renderRow('date-picker/simple')} + {divider} + {renderRow('date-picker/range')} {divider} - {renderNestedRow('data-grid/localization')} - - {divider} - {renderRow('date-picker/simple')} - {divider} - {renderRow('date-picker/range')} - {divider} - - - {chartsUnfoldMore} - - {chartsUnfoldMore} - - {chartsUnfoldMore} - - - - Components - {renderNestedRow('charts/line')} - {divider} - {renderNestedRow('charts/bar')} - {divider} - {renderNestedRow('charts/scatter')} - {divider} - {renderNestedRow('charts/pie')} - {divider} - {renderNestedRow('charts/sparkline')} - {divider} - {renderNestedRow('charts/gauge')} - {divider} - {renderNestedRow('charts/heatmap')} - {divider} - {renderNestedRow('charts/treemap')} - {divider} - {renderNestedRow('charts/radar')} - {divider} - {renderNestedRow('charts/funnel')} - {divider} - {renderNestedRow('charts/sankey')} - {divider} - {renderNestedRow('charts/gantt')} - {divider} - {renderNestedRow('charts/gantt-advanced')} - {divider} - {renderNestedRow('charts/candlestick')} - {divider} - {renderNestedRow('charts/large-dataset')} - {divider} - Interactions - {renderNestedRow('charts/legend')} - {divider} - {renderNestedRow('charts/tooltip')} - {divider} - {renderNestedRow('charts/zoom-and-pan')} - {divider} - {renderNestedRow('charts/export')} - {divider} - Data Grid Integration - {renderNestedRow('charts/cell-with-charts')} - {divider} - {renderNestedRow('charts/filter-interaction')} + (theme) => + theme.applyDarkStyles({ + '&:hover': { + bgcolor: alpha(theme.palette.primary.main, 0.06), + }, + }), + ]} + > + Charts + +
+ + Components + {renderNestedRow('charts/line')} + {divider} + {renderNestedRow('charts/bar')} + {divider} + {renderNestedRow('charts/scatter')} + {divider} + {renderNestedRow('charts/pie')} + {divider} + {renderNestedRow('charts/sparkline')} + {divider} + {renderNestedRow('charts/gauge')} + {divider} + {renderNestedRow('charts/heatmap')} + {divider} + {renderNestedRow('charts/treemap')} + {divider} + {renderNestedRow('charts/radar')} + {divider} + {renderNestedRow('charts/funnel')} + {divider} + {renderNestedRow('charts/sankey')} + {divider} + {renderNestedRow('charts/gantt')} + {divider} + {renderNestedRow('charts/gantt-advanced')} + {divider} + {renderNestedRow('charts/candlestick')} + {divider} + {renderNestedRow('charts/large-dataset')} + {divider} + Interactions + {renderNestedRow('charts/legend')} + {divider} + {renderNestedRow('charts/tooltip')} + {divider} + {renderNestedRow('charts/zoom-and-pan')} + {divider} + {renderNestedRow('charts/export')} + {divider} + Data Grid Integration + {renderNestedRow('charts/cell-with-charts')} + {divider} + {renderNestedRow('charts/filter-interaction')} + {divider} + {renderNestedRow('charts/selection-interaction')} + {divider} - {renderNestedRow('charts/selection-interaction')} - - {divider} - - - {treeViewUnfoldMore} - - {treeViewUnfoldMore} - - - {treeViewUnfoldMore} - - - - - Components - {renderNestedRow('tree-view/simple-tree-view')} + (theme) => + theme.applyDarkStyles({ + '&:hover': { + bgcolor: alpha(theme.palette.primary.main, 0.06), + }, + }), + ]} + > + TreeView + +
+ + Components + {renderNestedRow('tree-view/simple-tree-view')} + {divider} + {renderNestedRow('tree-view/rich-tree-view')} + {divider} + Advanced features + {renderNestedRow('tree-view/selection')} + {divider} + {renderNestedRow('tree-view/multi-selection')} + {divider} + {renderNestedRow('tree-view/inline-editing')} + {divider} + {renderNestedRow('tree-view/drag-to-reorder')} + {divider} + {renderNestedRow('tree-view/virtualization')} + {divider} + {divider} - {renderNestedRow('tree-view/rich-tree-view')} + {renderRow('mui-x-production')} {divider} - Advanced features - {renderNestedRow('tree-view/selection')} + {divider} - {renderNestedRow('tree-view/multi-selection')} + {renderRow('mui-x-updates')} + Support + {renderRow('core-support')} {divider} - {renderNestedRow('tree-view/inline-editing')} + {renderRow('x-support')} {divider} - {renderNestedRow('tree-view/drag-to-reorder')} + {renderRow('support-duration')} {divider} - {renderNestedRow('tree-view/virtualization')} + {renderRow('response-time')} {divider} - - {divider} - {renderRow('mui-x-production')} - {divider} - - {divider} - {renderRow('mui-x-updates')} - Support - {renderRow('core-support')} - {divider} - {renderRow('x-support')} - {divider} - {renderRow('support-duration')} - {divider} - {renderRow('response-time')} - {divider} - {renderRow('pre-screening')} - {divider} - {renderRow('issue-escalation')} - {divider} - {renderRow('security-questionnaire')} - {divider} - + {renderRow('pre-screening')} + {divider} + {renderRow('issue-escalation')} + {divider} + {renderRow('security-questionnaire')} + {divider} + + ); }