-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[core] Remove Storybook #6040
Merged
Merged
[core] Remove Storybook #6040
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1c409e4
[core] Remove Storybook
flaviendelangle 6446ec7
Work
flaviendelangle b8179ff
Merge
flaviendelangle fa6e05d
Fix
flaviendelangle 8a494fe
Fix
flaviendelangle 41b660a
Fix
flaviendelangle 6fc4d46
Fix
flaviendelangle e3c4aec
Merge
flaviendelangle 4befb9b
Merge branch 'master' into storybook
flaviendelangle 7cd40ed
[pickers] Allow nested `LocalizationProvider` (#6011)
flaviendelangle 0c08792
[pickers] `shouldDisableMonth` and `shouldDisableYear` should be used…
flaviendelangle 3e7bfb2
[pickers] Unify `PickersMonth` and `PickersYear` behaviors (#6034)
flaviendelangle 0591dad
Merge
flaviendelangle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './useDemoData'; | ||
export * from './useBasicDemoData'; | ||
export * from './useMovieData'; | ||
export * from './useQuery'; |
13 changes: 13 additions & 0 deletions
13
packages/grid/x-data-grid-generator/src/hooks/useBasicDemoData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
import { getBasicGridData, GridBasicData } from '../services'; | ||
|
||
export const useBasicDemoData = (nbRows: number, nbCols: number): GridBasicData => { | ||
const [data, setData] = React.useState<GridBasicData>({ rows: [], columns: [] }); | ||
|
||
React.useEffect(() => { | ||
const newData = getBasicGridData(nbRows, nbCols); | ||
setData(newData); | ||
}, [nbRows, nbCols]); | ||
|
||
return data; | ||
}; |
106 changes: 106 additions & 0 deletions
106
packages/grid/x-data-grid-generator/src/services/basic-data-service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { GridColDef, GridRowId } from '@mui/x-data-grid'; | ||
|
||
export const currencyPairs = [ | ||
'USDGBP', | ||
'USDEUR', | ||
'GBPEUR', | ||
'JPYUSD', | ||
'MXNUSD', | ||
'BTCUSD', | ||
'USDCAD', | ||
'EURJPY', | ||
'EURUSD', | ||
'EURCHF', | ||
'USDCHF', | ||
'EURGBP', | ||
'GBPUSD', | ||
'AUDCAD', | ||
'NZDUSD', | ||
'GBPCHF', | ||
'AUDUSD', | ||
'GBPJPY', | ||
'USDJPY', | ||
'CHFJPY', | ||
'EURCAD', | ||
'AUDJPY', | ||
'EURAUD', | ||
'AUDNZD', | ||
'CADEUR', | ||
'CHFMXN', | ||
'ETHUSD', | ||
'BCHUSD', | ||
'ETHBTC', | ||
'XRPUSD', | ||
'XRPBTC', | ||
'USDLTC', | ||
'USDXRP', | ||
'USDDSH', | ||
'USDBCH', | ||
'JPYEUR', | ||
'JPYUSD', | ||
'JPYGBP', | ||
'JPYCAD', | ||
'JPYCHF', | ||
'JPYAUD', | ||
'JPYNZD', | ||
'JPYSGD', | ||
'JPYNOK', | ||
'JPYRUB', | ||
'JPYSEK', | ||
'JPYTRY', | ||
'JPYZAR', | ||
'JPYHKD', | ||
'JPYCNH', | ||
'JPYDKK', | ||
'JPYMXN', | ||
'JPYPLN', | ||
'JPYXAG', | ||
'JPYXAU', | ||
'JPYBTC', | ||
'JPYETH', | ||
'JPYLTC', | ||
'JPYXRP', | ||
'JPYDSH', | ||
'JPYBCH', | ||
'GBPEUR', | ||
'GBPRUB', | ||
'GBPTRY', | ||
]; | ||
|
||
interface GridBasicRowModel { | ||
id: GridRowId; | ||
currencyPair: string; | ||
[price: string]: number | string; | ||
} | ||
|
||
export interface GridBasicData { | ||
columns: GridColDef[]; | ||
rows: GridBasicRowModel[]; | ||
} | ||
|
||
export const getBasicGridData = (rowLength: number, colLength: number): GridBasicData => { | ||
const data: GridBasicRowModel[] = []; | ||
const pricesColLength = colLength - 2; | ||
for (let i = 0; i < rowLength; i += 1) { | ||
const idx = i >= currencyPairs.length ? i % currencyPairs.length : i; | ||
const model: GridBasicRowModel = { | ||
id: i, | ||
currencyPair: currencyPairs[idx], | ||
}; | ||
for (let j = 1; j <= pricesColLength; j += 1) { | ||
model[`price${j}M`] = Number(`${i.toString()}${j}`); // randomPrice(0.7, 2); | ||
} | ||
data.push(model); | ||
} | ||
|
||
const columns: GridColDef[] = [ | ||
{ field: 'id', headerName: 'id', type: 'number' }, | ||
{ field: 'currencyPair', headerName: 'Currency Pair' }, | ||
]; | ||
for (let j = 1; j <= pricesColLength; j += 1) { | ||
// const y = Math.floor(j / 12); | ||
columns.push({ field: `price${j}M`, headerName: `${j}M`, type: 'number' }); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M` | ||
} | ||
columns.length = colLength; // we cut the array in case < 2; | ||
return { columns, rows: data }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './gridColDefGenerator'; | ||
export * from './random-generator'; | ||
export * from './real-data-service'; | ||
export * from './basic-data-service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I guess this was part of the storybook package. I wanter if we can remove it altogether and just use either the
Commodity
orEmployee
data sets. If there are no assertions in the tests related to the value of the cells then replacing the data set should be more or less easy, what do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it's the old
useData
andgetData
.For the tests, it can be useful to have those dummy data tests without any intelligence behind them.
For instance in the pagination, it makes very clear what you are testing.
I would personally be in favor of an even dumber data set.
Something like:
And to use it everywhere we have some "Nike" / "Puma" dataset.
To reduce as much as possible the complexity of understanding the dataset and focusing on the actual behavior we are testing.