-
Notifications
You must be signed in to change notification settings - Fork 22
feat(CoverHero): new component #1144
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a8a2a35
WEB-1848 feat(CoverHero): new component
atabel b5a9e8d
Merge branch 'master' into atoledano-cover-hero
atabel 6d9461c
cover hero
atabel ef3a01b
Merge branch 'master' into atoledano-cover-hero
atabel fe2d62c
fix dark mode
atabel 48dd2ed
update screenshots
atabel 6ab715f
removed image zindex
atabel f06b9aa
story inside slideshow. Snippets
atabel 7050a1d
aria-label dataAttributes and background instead of backgroundColor
atabel 1333362
fixes from CR
atabel 65a68fc
fix description width when using centered+sideExtra
atabel 07aa5e7
take screenshots of the component instead of the whole page
atabel 07892d8
Merge branch 'master' into atoledano-cover-hero
atabel 280a690
allow CoverHero without buttons
atabel 6fc25a0
ssr test
atabel 516baf5
limit centered content to 8 columns
atabel 68cca1f
Merge branch 'master' into atoledano-cover-hero
atabel 5307fa6
aspect-ratio polyfill
atabel e8fad1f
add component-name to GridLayout
atabel 904e361
Merge branch 'master' into atoledano-cover-hero
atabel c591980
improve story comment
atabel d465585
add reference to csf PR
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 hidden or 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 added
BIN
+698 KB
.../cover-hero-screenshot-test-tsx-cover-hero-desktop-16-9-aspect-ratio-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 added
BIN
+448 KB
...apshots__/cover-hero-screenshot-test-tsx-cover-hero-desktop-centered-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 added
BIN
+465 KB
...nshot-test-tsx-cover-hero-desktop-centered-with-extra-and-side-extra-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 added
BIN
+807 KB
...pshots__/cover-hero-screenshot-test-tsx-cover-hero-desktop-long-text-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 added
BIN
+807 KB
...ero-screenshot-test-tsx-cover-hero-desktop-long-text-with-side-extra-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 added
BIN
+437 KB
...napshots__/cover-hero-screenshot-test-tsx-cover-hero-desktop-minimal-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 added
BIN
+455 KB
...shots__/cover-hero-screenshot-test-tsx-cover-hero-desktop-one-button-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 added
BIN
+455 KB
...apshots__/cover-hero-screenshot-test-tsx-cover-hero-desktop-one-link-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 added
BIN
+455 KB
...er-hero-screenshot-test-tsx-cover-hero-desktop-with-background-image-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 added
BIN
+493 KB
...er-hero-screenshot-test-tsx-cover-hero-desktop-with-background-video-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 added
BIN
+465 KB
...ero-screenshot-test-tsx-cover-hero-desktop-with-extra-and-side-extra-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 added
BIN
+20.5 KB
...hero-screenshot-test-tsx-cover-hero-desktop-with-variant-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 added
BIN
+20.6 KB
...ver-hero-screenshot-test-tsx-cover-hero-desktop-with-variant-default-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 added
BIN
+20 KB
...ver-hero-screenshot-test-tsx-cover-hero-desktop-with-variant-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 added
BIN
+314 KB
...shots__/cover-hero-screenshot-test-tsx-cover-hero-inside-a-slideshow-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 added
BIN
+644 KB
..._/cover-hero-screenshot-test-tsx-cover-hero-mobile-7-10-aspect-ratio-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 added
BIN
+498 KB
...napshots__/cover-hero-screenshot-test-tsx-cover-hero-mobile-centered-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 added
BIN
+645 KB
...enshot-test-tsx-cover-hero-mobile-centered-with-extra-and-side-extra-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 added
BIN
+919 KB
...apshots__/cover-hero-screenshot-test-tsx-cover-hero-mobile-long-text-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 added
BIN
+714 KB
..._/cover-hero-screenshot-test-tsx-cover-hero-mobile-min-height-100-vh-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 added
BIN
+496 KB
...snapshots__/cover-hero-screenshot-test-tsx-cover-hero-mobile-minimal-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 added
BIN
+648 KB
...hero-screenshot-test-tsx-cover-hero-mobile-with-extra-and-side-extra-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 added
BIN
+322 KB
...hero-screenshot-test-tsx-cover-hero-tablet-with-extra-and-side-extra-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.
209 changes: 209 additions & 0 deletions
209
src/__screenshot_tests__/cover-hero-screenshot-test.tsx
This file contains hidden or 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,209 @@ | ||
| import {openStoryPage} from '../test-utils'; | ||
|
|
||
| const cases = [ | ||
| [ | ||
| 'desktop with background image', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {background: 'image'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop with background video', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {background: 'video'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop with variant inverse', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {background: 'color from skin', variant: 'inverse'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop with variant alternative', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {background: 'color from skin', variant: 'alternative'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop with variant default', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {background: 'color from skin', variant: 'default'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop with extra and sideExtra', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {withExtra: true, withSideExtra: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile with extra and sideExtra', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: {withExtra: true, withSideExtra: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'tablet with extra and sideExtra', | ||
| { | ||
| device: 'TABLET', | ||
| args: {withExtra: true, withSideExtra: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop centered', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {centered: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile centered', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: {centered: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop centered with extra and sideExtra', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {centered: true, withExtra: true, withSideExtra: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile centered with extra and sideExtra', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: {centered: true, withExtra: true, withSideExtra: true}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop one button', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {actions: 'button'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop one link', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: {actions: 'link'}, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop long text', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: { | ||
| title: 'Long title '.repeat(10), | ||
| description: 'This is a long description with a long text to see how this works'.repeat(10), | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop long text with sideExtra', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: { | ||
| title: 'Long title '.repeat(10), | ||
| description: 'This is a long description with a long text to see how this works'.repeat(10), | ||
| withSideExtra: true, | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile long text', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: { | ||
| title: 'Long title '.repeat(10), | ||
| description: 'This is a long description with a long text to see how this works'.repeat(10), | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop 16:9 aspect ratio', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: { | ||
| aspectRatio: '16 9', | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile 7:10 aspect ratio', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: { | ||
| aspectRatio: '7 10', | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile minHeight 100vh', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: { | ||
| minHeight: '100vh', | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'desktop minimal', | ||
| { | ||
| device: 'DESKTOP', | ||
| args: { | ||
| headline: '', | ||
| pretitle: '', | ||
| title: 'Title', | ||
| description: '', | ||
| actions: 'button', | ||
| }, | ||
| }, | ||
| ], | ||
| [ | ||
| 'mobile minimal', | ||
| { | ||
| device: 'MOBILE_IOS', | ||
| args: { | ||
| headline: '', | ||
| pretitle: '', | ||
| title: 'Title', | ||
| description: '', | ||
| actions: 'button', | ||
| }, | ||
| }, | ||
| ], | ||
| ] as const; | ||
|
|
||
| test.each(cases)('CoverHero %s', async (_name, {device, args}) => { | ||
| const page = await openStoryPage({ | ||
| id: 'components-hero-coverhero--default', | ||
| device, | ||
| args, | ||
| }); | ||
|
|
||
| const image = await page.screenshot(); | ||
| expect(image).toMatchImageSnapshot(); | ||
| }); | ||
|
|
||
| test('CoverHero inside a Slideshow', async () => { | ||
| const page = await openStoryPage({ | ||
| id: 'components-hero-coverhero--cover-hero-in-slideshow', | ||
| args: { | ||
| background: 'image', | ||
| }, | ||
| }); | ||
|
|
||
| const image = await page.screenshot(); | ||
| expect(image).toMatchImageSnapshot(); | ||
| }); | ||
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.