-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat(Table): new component #1129
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fd86c17
WEB-1870 feat(Table): new component
atabel be044ba
tests
atabel f4233f3
snippets
atabel a98ca43
snippets
atabel df41437
comment
atabel 92c108a
simplify and comment some styles
atabel af45ccf
vertical align middle cells
atabel f621e4c
fix advanced data card
atabel e8d7bf3
fix navigation bar ssr test
atabel 39285a1
changes from CR
atabel 07598f6
fixes
atabel 91da2b2
doc
atabel 5ee2705
fix boxed non fullWidth in tablet
atabel 2383126
Merge branch 'master' into atoledano-table
atabel cce55e0
fix scroll paddings, sticky heading padding, and column width
atabel cfab953
update screenshots
atabel 9004f64
Merge branch 'master' into atoledano-table
atabel 4bd356a
update screenshots
atabel ca1d352
change paddingX in mobile for boxed table
atabel aedfd55
allow any ReactNode in headings
atabel a4c2cca
Merge branch 'master' into atoledano-table
atabel 6346e75
fix scrollOverResponsiveLayout in FF
atabel 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
Binary file modified
BIN
+69.1 KB
(110%)
...ots__/private-skin-components-screenshot-test-tsx-components-in-blau-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.1 KB
(110%)
...e-skin-components-screenshot-test-tsx-components-in-blau-alternative-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+68.8 KB
(110%)
...ate-skin-components-screenshot-test-tsx-components-in-blau-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+68.2 KB
(110%)
...ivate-skin-components-screenshot-test-tsx-components-in-blau-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+69.2 KB
(110%)
...ponents-screenshot-test-tsx-components-in-blau-inverse-and-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72.1 KB
(110%)
..._/private-skin-components-screenshot-test-tsx-components-in-movistar-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+71.7 KB
(110%)
...in-components-screenshot-test-tsx-components-in-movistar-alternative-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72.7 KB
(110%)
...skin-components-screenshot-test-tsx-components-in-movistar-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.7 KB
(110%)
...e-skin-components-screenshot-test-tsx-components-in-movistar-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72.9 KB
(110%)
...nts-screenshot-test-tsx-components-in-movistar-inverse-and-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.8 KB
(110%)
...hots__/private-skin-components-screenshot-test-tsx-components-in-o-2-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.7 KB
(110%)
...te-skin-components-screenshot-test-tsx-components-in-o-2-alternative-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.2 KB
(110%)
...vate-skin-components-screenshot-test-tsx-components-in-o-2-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72.1 KB
(110%)
...rivate-skin-components-screenshot-test-tsx-components-in-o-2-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.4 KB
(110%)
...mponents-screenshot-test-tsx-components-in-o-2-inverse-and-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.9 KB
(110%)
...__/private-skin-components-screenshot-test-tsx-components-in-o-2-new-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72 KB
(110%)
...kin-components-screenshot-test-tsx-components-in-o-2-new-alternative-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72.4 KB
(110%)
...-skin-components-screenshot-test-tsx-components-in-o-2-new-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+71.3 KB
(110%)
...te-skin-components-screenshot-test-tsx-components-in-o-2-new-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72.8 KB
(110%)
...ents-screenshot-test-tsx-components-in-o-2-new-inverse-and-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.5 KB
(110%)
...private-skin-components-screenshot-test-tsx-components-in-telefonica-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.9 KB
(110%)
...-components-screenshot-test-tsx-components-in-telefonica-alternative-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+71.6 KB
(110%)
...in-components-screenshot-test-tsx-components-in-telefonica-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+65 KB
(110%)
...skin-components-screenshot-test-tsx-components-in-telefonica-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+70.9 KB
(110%)
...s-screenshot-test-tsx-components-in-telefonica-inverse-and-dark-mode-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+69.2 KB
(110%)
...shots__/private-skin-components-screenshot-test-tsx-components-in-tu-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+69.7 KB
(110%)
...ate-skin-components-screenshot-test-tsx-components-in-tu-alternative-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+72.7 KB
(110%)
...ivate-skin-components-screenshot-test-tsx-components-in-tu-dark-mode-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+70.1 KB
(110%)
...private-skin-components-screenshot-test-tsx-components-in-tu-inverse-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+72.3 KB
(110%)
...omponents-screenshot-test-tsx-components-in-tu-inverse-and-dark-mode-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+69.1 KB
(110%)
..._/private-skin-components-screenshot-test-tsx-components-in-vivo-new-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+69.2 KB
(110%)
...in-components-screenshot-test-tsx-components-in-vivo-new-alternative-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+68.5 KB
(110%)
...skin-components-screenshot-test-tsx-components-in-vivo-new-dark-mode-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+69.5 KB
(110%)
...e-skin-components-screenshot-test-tsx-components-in-vivo-new-inverse-1-snap.png
Oops, something went wrong.
Binary file modified
BIN
+67.5 KB
(110%)
...nts-screenshot-test-tsx-components-in-vivo-new-inverse-and-dark-mode-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+47 KB
...__/__image_snapshots__/table-screenshot-test-tsx-table-desktop-boxed-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+45.9 KB
...ots__/table-screenshot-test-tsx-table-desktop-boxed-full-width-false-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+46.4 KB
...ge_snapshots__/table-screenshot-test-tsx-table-desktop-boxed-inverse-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+16.7 KB
...mage_snapshots__/table-screenshot-test-tsx-table-desktop-empty-boxed-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+16 KB
...image_snapshots__/table-screenshot-test-tsx-table-desktop-empty-case-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+44.5 KB
...image_snapshots__/table-screenshot-test-tsx-table-desktop-full-width-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+44.9 KB
...snapshots__/table-screenshot-test-tsx-table-desktop-full-width-false-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+42.5 KB
.../__image_snapshots__/table-screenshot-test-tsx-table-desktop-inverse-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+27.2 KB
...image_snapshots__/table-screenshot-test-tsx-table-desktop-max-height-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+28.9 KB
...snapshots__/table-screenshot-test-tsx-table-desktop-max-height-boxed-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+66.4 KB
...t_tests__/__image_snapshots__/table-screenshot-test-tsx-table-mobile-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+58.7 KB
...s__/__image_snapshots__/table-screenshot-test-tsx-table-mobile-boxed-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+67.4 KB
...age_snapshots__/table-screenshot-test-tsx-table-mobile-collapse-rows-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+69.5 KB
...apshots__/table-screenshot-test-tsx-table-mobile-collapse-rows-boxed-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+70.2 KB
..._/table-screenshot-test-tsx-table-mobile-collapse-rows-boxed-inverse-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+64.2 KB
...shots__/table-screenshot-test-tsx-table-mobile-collapse-rows-inverse-1-snap.png
Oops, something went wrong.
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,127 @@ | ||
import {openStoryPage} from '../test-utils'; | ||
|
||
const cases = [ | ||
[ | ||
'desktop fullWidth', | ||
{ | ||
device: 'DESKTOP', | ||
args: {fullWidth: true}, | ||
}, | ||
], | ||
[ | ||
'desktop fullWidth false', | ||
{ | ||
device: 'DESKTOP', | ||
args: {fullWidth: false}, | ||
}, | ||
], | ||
[ | ||
'desktop boxed', | ||
{ | ||
device: 'DESKTOP', | ||
args: {boxed: true}, | ||
}, | ||
], | ||
[ | ||
'desktop boxed fullWidth false', | ||
{ | ||
device: 'DESKTOP', | ||
args: {boxed: true, fullWidth: false}, | ||
}, | ||
], | ||
[ | ||
'desktop inverse', | ||
{ | ||
device: 'DESKTOP', | ||
args: {inverse: true}, | ||
}, | ||
], | ||
[ | ||
'desktop boxed inverse', | ||
{ | ||
device: 'DESKTOP', | ||
args: {inverse: true, boxed: true}, | ||
}, | ||
], | ||
[ | ||
'desktop maxHeight', | ||
{ | ||
device: 'DESKTOP', | ||
args: {maxHeight: 200}, | ||
}, | ||
], | ||
[ | ||
'desktop maxHeight boxed', | ||
{ | ||
device: 'DESKTOP', | ||
args: {maxHeight: 200, boxed: true}, | ||
}, | ||
], | ||
[ | ||
'desktop empty case', | ||
{ | ||
device: 'DESKTOP', | ||
args: {numItems: 0}, | ||
}, | ||
], | ||
[ | ||
'desktop empty boxed', | ||
{ | ||
device: 'DESKTOP', | ||
args: {numItems: 0, boxed: true}, | ||
}, | ||
], | ||
[ | ||
'mobile', | ||
{ | ||
device: 'MOBILE_IOS', | ||
args: {}, | ||
}, | ||
], | ||
[ | ||
'mobile boxed', | ||
{ | ||
device: 'MOBILE_IOS', | ||
args: {boxed: true}, | ||
}, | ||
], | ||
[ | ||
'mobile collapse-rows', | ||
{ | ||
device: 'MOBILE_IOS', | ||
args: {responsive: 'collapse-rows'}, | ||
}, | ||
], | ||
[ | ||
'mobile collapse-rows boxed', | ||
{ | ||
device: 'MOBILE_IOS', | ||
args: {responsive: 'collapse-rows', boxed: true}, | ||
}, | ||
], | ||
[ | ||
'mobile collapse-rows inverse', | ||
{ | ||
device: 'MOBILE_IOS', | ||
args: {responsive: 'collapse-rows', inverse: true}, | ||
}, | ||
], | ||
[ | ||
'mobile collapse-rows boxed inverse', | ||
{ | ||
device: 'MOBILE_IOS', | ||
args: {responsive: 'collapse-rows', boxed: true, inverse: true}, | ||
}, | ||
], | ||
] as const; | ||
|
||
test.each(cases)('Table %s', async (_name, {device, args}) => { | ||
const page = await openStoryPage({ | ||
id: 'components-table--default', | ||
device, | ||
args, | ||
}); | ||
|
||
const image = await page.screenshot(); | ||
expect(image).toMatchImageSnapshot(); | ||
}); |
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,120 @@ | ||
import * as React from 'react'; | ||
import {ResponsiveLayout, Box, Table, Tag} from '..'; | ||
|
||
export default { | ||
title: 'Components/Table', | ||
parameters: {fullScreen: true}, | ||
}; | ||
|
||
const foodList = [ | ||
['Slice of pizza', '450', '95%', '5,00€', <Tag>Common</Tag>, '8/10'], | ||
['Hamburger', '350', '87%', '3,50€', <Tag>Common</Tag>, '7.5/10'], | ||
['Salad', '150', '70%', '4,00€', <Tag>Common</Tag>, '6/10'], | ||
['Sushi', '200', '90%', '12,00€', <Tag type="warning">Rare</Tag>, '9/10'], | ||
['Ice cream', '350', '95%', '3,00€', <Tag>Common</Tag>, '8/10'], | ||
['Cake', '500', '90%', '5,00€', <Tag>Common</Tag>, '8/10'], | ||
['Pasta', '300', '80%', '6,00€', <Tag>Common</Tag>, '7/10'], | ||
['Fries', '250', '85%', '2,50€', <Tag>Common</Tag>, '7/10'], | ||
['Hot dog', '400', '80%', '4,00€', <Tag>Common</Tag>, '7/10'], | ||
['Steak', '600', '95%', '15,00€', <Tag type="warning">Rare</Tag>, '9/10'], | ||
['Ramen', '400', '85%', '10,00€', <Tag type="warning">Rare</Tag>, '8/10'], | ||
['Pancakes', '350', '90%', '4,00€', <Tag>Common</Tag>, '8/10'], | ||
['Tacos', '300', '85%', '8,00€', <Tag>Common</Tag>, '7/10'], | ||
['Donuts', '300', '95%', '2,00€', <Tag>Common</Tag>, '8/10'], | ||
['Soup', '200', '80%', '3,00€', <Tag>Common</Tag>, '6/10'], | ||
['Curry', '400', '90%', '9,00€', <Tag>Common</Tag>, '8/10'], | ||
['Fish and chips', '500', '85%', '7,00€', <Tag>Common</Tag>, '7/10'], | ||
['Burger', '350', '85%', '4,00€', <Tag>Common</Tag>, '7/10'], | ||
['Kebab', '500', '90%', '6,00€', <Tag>Common</Tag>, '8/10'], | ||
['Waffles', '400', '95%', '5,00€', <Tag>Common</Tag>, '8/10'], | ||
['Pretzel', '300', '85%', '2,50€', <Tag>Common</Tag>, '7/10'], | ||
['Cheeseburger', '450', '85%', '5,00€', <Tag>Common</Tag>, '7/10'], | ||
['Nachos', '300', '80%', '3,00€', <Tag>Common</Tag>, '6/10'], | ||
['Lasagna', '500', '90%', '8,00€', <Tag>Common</Tag>, '8/10'], | ||
]; | ||
|
||
type Args = { | ||
inverse: boolean; | ||
boxed: boolean; | ||
responsive: 'scroll' | 'collapse-rows'; | ||
fullWidth: boolean; | ||
scrollOverResponsiveLayout: boolean; | ||
maxHeight: string | undefined; | ||
numItems: number; | ||
emptyCase: string; | ||
columnTextAlign: Array<'left' | 'right' | 'center'>; | ||
rowVerticalAlign: 'top' | 'middle'; | ||
columnWidth: Array<number | string>; | ||
}; | ||
|
||
export const Default: StoryComponent<Args> = ({ | ||
inverse, | ||
boxed, | ||
responsive, | ||
fullWidth, | ||
scrollOverResponsiveLayout, | ||
maxHeight, | ||
numItems, | ||
emptyCase, | ||
columnTextAlign, | ||
rowVerticalAlign, | ||
columnWidth, | ||
}) => { | ||
return ( | ||
<ResponsiveLayout isInverse={inverse}> | ||
<Box paddingY={24}> | ||
<Table | ||
fullWidth={fullWidth} | ||
maxHeight={maxHeight} | ||
responsive={responsive} | ||
boxed={boxed} | ||
heading={[ | ||
'Type of food', | ||
'Calories', | ||
'Tasty Factor', | ||
'Average Price', | ||
'Rarity', | ||
'Average Rating', | ||
]} | ||
columnTextAlign={columnTextAlign} | ||
columnWidth={columnWidth} | ||
rowVerticalAlign={rowVerticalAlign} | ||
content={foodList.slice(0, numItems)} | ||
emptyCase={emptyCase} | ||
scrollOverResponsiveLayout={scrollOverResponsiveLayout} | ||
/> | ||
</Box> | ||
</ResponsiveLayout> | ||
); | ||
}; | ||
|
||
Default.storyName = 'Table'; | ||
Default.args = { | ||
inverse: false, | ||
boxed: false, | ||
responsive: 'scroll', | ||
fullWidth: true, | ||
scrollOverResponsiveLayout: true, | ||
maxHeight: undefined, | ||
numItems: 5, | ||
emptyCase: 'No food items found', | ||
columnTextAlign: ['left', 'right', 'right', 'right', 'center', 'right'], | ||
rowVerticalAlign: 'middle', | ||
columnWidth: ['auto', 'auto', 'auto', 'auto', 'auto', 'auto'], | ||
}; | ||
Default.argTypes = { | ||
responsive: { | ||
options: ['scroll', 'collapse-rows'], | ||
control: {type: 'select'}, | ||
}, | ||
maxHeight: { | ||
control: {type: 'text'}, | ||
}, | ||
numItems: { | ||
control: {type: 'range', min: 0, max: foodList.length, step: 1}, | ||
}, | ||
rowVerticalAlign: { | ||
options: ['top', 'middle'], | ||
control: {type: 'select'}, | ||
}, | ||
}; |
Oops, something went wrong.
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.
can you include columnTextAlign to make easy the usage of this prop? (also for boxed snippet)
columnTextAlign={["left", "right", "right", "right", "center", "right"]}