Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tree view][docs] Adjust all demos height to account for the updated design #11979

Merged
merged 4 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions docs/data/data-grid/editing/ValidateServerNameGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ function validateName(username) {
const existingUsers = rows.map((row) => row.name.toLowerCase());

return new Promise((resolve) => {
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
promiseTimeout = setTimeout(
() => {
const exists = existingUsers.includes(username.toLowerCase());
resolve(exists ? `${username} is already taken.` : null);
},
Math.random() * 500 + 100,
); // simulate network latency
promiseTimeout = setTimeout(() => {
const exists = existingUsers.includes(username.toLowerCase());
resolve(exists ? `${username} is already taken.` : null);
}, Math.random() * 500 + 100); // simulate network latency
});
}

Expand Down
15 changes: 6 additions & 9 deletions docs/data/data-grid/row-ordering/RowOrderingGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import { useDemoData } from '@mui/x-data-grid-generator';

function updateRowPosition(initialIndex, newIndex, rows) {
return new Promise((resolve) => {
setTimeout(
() => {
const rowsClone = [...rows];
const row = rowsClone.splice(initialIndex, 1)[0];
rowsClone.splice(newIndex, 0, row);
resolve(rowsClone);
},
Math.random() * 500 + 100,
); // simulate network latency
setTimeout(() => {
const rowsClone = [...rows];
const row = rowsClone.splice(initialIndex, 1)[0];
rowsClone.splice(newIndex, 0, row);
resolve(rowsClone);
}, Math.random() * 500 + 100); // simulate network latency
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import { useDemoData, randomInt } from '@mui/x-data-grid-generator';

function loadServerRows(page, data) {
return new Promise((resolve) => {
setTimeout(
() => {
resolve(data.rows.slice(page * 5, (page + 1) * 5));
},
randomInt(100, 600),
); // simulate network latency
setTimeout(() => {
resolve(data.rows.slice(page * 5, (page + 1) * 5));
}, randomInt(100, 600)); // simulate network latency
});
}

Expand Down
17 changes: 7 additions & 10 deletions docs/data/data-grid/tree-data/TreeDataLazyLoading.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,13 @@ const getChildren = (parentPath) => {
*/
const fakeDataFetcher = (parentPath = []) =>
new Promise((resolve) => {
setTimeout(
() => {
const rows = getChildren(parentPath).map((row) => ({
...row,
descendantCount: getChildren(row.hierarchy).length,
}));
resolve(rows);
},
500 + Math.random() * 300,
);
setTimeout(() => {
const rows = getChildren(parentPath).map((row) => ({
...row,
descendantCount: getChildren(row.hierarchy).length,
}));
resolve(rows);
}, 500 + Math.random() * 300);
});

const LoadingContainer = styled('div')({
Expand Down
4 changes: 2 additions & 2 deletions docs/data/date-pickers/lifecycle/ServerInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function DisplayEvents(props) {
value === null
? 'null'
: value.isValid()
? value.format('DD/MM/YYYY')
: 'Invalid Date'
? value.format('DD/MM/YYYY')
: 'Invalid Date'
}`,
)
.join('\n')}
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/getting-started/FirstComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function FirstComponent() {
return (
<SimpleTreeView
aria-label="file system navigator"
sx={{ height: 240, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
sx={{ height: 200, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
>
<TreeItem nodeId="1" label="Applications">
<TreeItem nodeId="2" label="Calendar" />
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/getting-started/FirstComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function FirstComponent() {
return (
<SimpleTreeView
aria-label="file system navigator"
sx={{ height: 240, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
sx={{ height: 200, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
>
<TreeItem nodeId="1" label="Applications">
<TreeItem nodeId="2" label="Calendar" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<SimpleTreeView
aria-label="file system navigator"
sx={{ height: 240, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
sx={{ height: 200, flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}
>
<TreeItem nodeId="1" label="Applications">
<TreeItem nodeId="2" label="Calendar" />
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/overview/BasicRichTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MUI_X_PRODUCTS = [

export default function BasicRichTreeView() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ height: 220, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/overview/BasicRichTreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MUI_X_PRODUCTS: TreeViewBaseItem[] = [

export default function BasicRichTreeView() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ height: 220, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/overview/BasicSimpleTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TreeItem } from '@mui/x-tree-view/TreeItem';

export default function BasicSimpleTreeView() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ height: 220, flexGrow: 1, maxWidth: 400 }}>
<SimpleTreeView>
<TreeItem nodeId="grid" label="Data Grid">
<TreeItem nodeId="grid-community" label="@mui/x-data-grid" />
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/overview/BasicSimpleTreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TreeItem } from '@mui/x-tree-view/TreeItem';

export default function BasicSimpleTreeView() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ height: 220, flexGrow: 1, maxWidth: 400 }}>
<SimpleTreeView>
<TreeItem nodeId="grid" label="Data Grid">
<TreeItem nodeId="grid-community" label="@mui/x-data-grid" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function ControlledExpansion() {
{expandedNodes.length === 0 ? 'Expand all' : 'Collapse all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
expandedNodes={expandedNodes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function ControlledExpansion() {
{expandedNodes.length === 0 ? 'Expand all' : 'Collapse all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
expandedNodes={expandedNodes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{expandedNodes.length === 0 ? 'Expand all' : 'Collapse all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
expandedNodes={expandedNodes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function TrackNodeExpansionToggle() {
</Typography>
)}

<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
onNodeExpansionToggle={handleNodeExpansionToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function TrackNodeExpansionToggle() {
Last action: {action.isExpanded ? 'expand' : 'collapse'} {action.nodeId}
</Typography>
)}
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
onNodeExpansionToggle={handleNodeExpansionToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last action: {action.isExpanded ? 'expand' : 'collapse'} {action.nodeId}
</Typography>
)}
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
onNodeExpansionToggle={handleNodeExpansionToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MUI_X_PRODUCTS = [

export default function BasicRichTreeView() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MUI_X_PRODUCTS: TreeViewBaseItem[] = [

export default function BasicRichTreeView() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function DisabledItemsFocusable() {
label="Allow focusing disabled items"
/>
</Box>
<Box sx={{ height: 312, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
isItemDisabled={isItemDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function DisabledItemsFocusable() {
label="Allow focusing disabled items"
/>
</Box>
<Box sx={{ height: 312, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
isItemDisabled={isItemDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const isItemDisabled = (item) => !!item.disabled;

export default function DisabledPropItem() {
return (
<Box sx={{ height: 312, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} isItemDisabled={isItemDisabled} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const isItemDisabled = (item: MuiXProduct) => !!item.disabled;

export default function DisabledPropItem() {
return (
<Box sx={{ height: 312, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} isItemDisabled={isItemDisabled} />
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/rich-tree-view/items/GetItemId.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getItemId = (item) => item.internalId;

export default function GetItemId() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} getItemId={getItemId} />
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/rich-tree-view/items/GetItemId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const getItemId = (item: MuiXProduct) => item.internalId;

export default function GetItemId() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} getItemId={getItemId} />
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/rich-tree-view/items/GetItemLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getItemLabel = (item) => item.name;

export default function GetItemLabel() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} getItemLabel={getItemLabel} />
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view/rich-tree-view/items/GetItemLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const getItemLabel = (item: MuiXProduct) => item.name;

export default function GetItemLabel() {
return (
<Box sx={{ height: 168, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView items={MUI_X_PRODUCTS} getItemLabel={getItemLabel} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function ControlledSelection() {
{selectedNodes.length === 0 ? 'Select all' : 'Unselect all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
selectedNodes={selectedNodes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function ControlledSelection() {
{selectedNodes.length === 0 ? 'Select all' : 'Unselect all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
selectedNodes={selectedNodes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{selectedNodes.length === 0 ? 'Select all' : 'Unselect all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
selectedNodes={selectedNodes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const MUI_X_PRODUCTS = [

export default function DisableSelection() {
return (
<Box sx={{ height: 264, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView disableSelection items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const MUI_X_PRODUCTS: TreeViewBaseItem[] = [

export default function DisableSelection() {
return (
<Box sx={{ height: 264, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView disableSelection items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const MUI_X_PRODUCTS = [

export default function MultiSelectTreeView() {
return (
<Box sx={{ height: 264, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView multiSelect items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const MUI_X_PRODUCTS: TreeViewBaseItem[] = [

export default function MultiSelectTreeView() {
return (
<Box sx={{ height: 264, flexGrow: 1, maxWidth: 400 }}>
<Box sx={{ minHeight: 200, flexGrow: 1, maxWidth: 400 }}>
<RichTreeView multiSelect items={MUI_X_PRODUCTS} />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function TrackNodeSelectionToggle() {
? 'No node selection recorded'
: `Last selected node: ${lastSelectedNode}`}
</Typography>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, minWidth: 250, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
onNodeSelectionToggle={handleNodeSelectionToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function TrackNodeSelectionToggle() {
? 'No node selection recorded'
: `Last selected node: ${lastSelectedNode}`}
</Typography>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, minWidth: 250, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
onNodeSelectionToggle={handleNodeSelectionToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
? 'No node selection recorded'
: `Last selected node: ${lastSelectedNode}`}
</Typography>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, minWidth: 250, flexGrow: 1 }}>
<RichTreeView
items={MUI_X_PRODUCTS}
onNodeSelectionToggle={handleNodeSelectionToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function ControlledExpansion() {
{expandedNodes.length === 0 ? 'Expand all' : 'Collapse all'}
</Button>
</Box>
<Box sx={{ height: 264, flexGrow: 1 }}>
<Box sx={{ minHeight: 200, flexGrow: 1 }}>
<SimpleTreeView
expandedNodes={expandedNodes}
onExpandedNodesChange={handleExpandedNodesChange}
Expand Down
Loading
Loading