-
-
Notifications
You must be signed in to change notification settings - Fork 11
551-refactor: Fsd widget merch #670
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1f817ae
refactor: 551 - change merch component
MielomankA 14aceee
refactor: 551 - change merch tests
MielomankA 4be926d
refactor: 551 - improve image render
MielomankA c936b31
chore: 551 - update to main
MielomankA 948b698
refactor: 551 - fix text render
MielomankA 2e440ae
refactor: 551 - code review comments
MielomankA ee8afd1
refactor: 551 - combine tests
MielomankA 97658a9
fix: 551 - change content and merch image
MielomankA 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
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,7 @@ | ||
export const merchData = { | ||
label: 'merch', | ||
title: 'RS merch', | ||
mainParagraph: 'Are you an RS sloth fan and looking for RS merch?', | ||
description: 'The wait is almost over as we are gearing up for the catalog of free web and print assets where you will find all merch collections and can print your own Rolling Scopes stickers, t-shirts etc.', | ||
linkTitle: 'Discover merch assets', | ||
}; |
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
This file was deleted.
Oops, something went wrong.
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
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,35 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { beforeEach, describe, expect, it } from 'vitest'; | ||
import { Merch } from './merch'; | ||
import { MOCKED_MERCH_DATA } from '@/shared/__tests__/constants'; | ||
import { renderWithRouter } from '@/shared/__tests__/utils'; | ||
|
||
describe('Merch', () => { | ||
beforeEach(() => { | ||
renderWithRouter(<Merch />); | ||
}); | ||
|
||
it('renders the content correctly', () => { | ||
const titleElement = screen.getByText(MOCKED_MERCH_DATA.title); | ||
const subtitleElement = screen.getByText(MOCKED_MERCH_DATA.subtitle); | ||
const paragraphText = screen.getByText(new RegExp(MOCKED_MERCH_DATA.paragraph, 'i')); | ||
|
||
expect(titleElement).toBeVisible(); | ||
expect(subtitleElement).toBeVisible(); | ||
expect(paragraphText).toBeVisible(); | ||
}); | ||
|
||
it('renders the merch "Discover merch assets" button with correct href', () => { | ||
const buttonElement = screen.getByRole('link', { name: new RegExp(MOCKED_MERCH_DATA.buttonText, 'i') }); | ||
|
||
expect(buttonElement).toBeVisible(); | ||
expect(buttonElement).toHaveAttribute('href', MOCKED_MERCH_DATA.buttonLink); | ||
}); | ||
|
||
it('renders the image with alt text', () => { | ||
const imageElement = screen.getByTestId('collage-with-merch'); | ||
|
||
expect(imageElement).toBeVisible(); | ||
expect(imageElement).toHaveAttribute('alt', MOCKED_MERCH_DATA.imageAltText); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,34 +1,35 @@ | ||
import classNames from 'classnames/bind'; | ||
import Image from 'next/image'; | ||
import { LINKS } from '@/core/const'; | ||
import image from '@/shared/assets/merch.webp'; | ||
import rsSchoolMerchImage from '@/shared/assets/merch.webp'; | ||
import { LinkCustom } from '@/shared/ui/link-custom'; | ||
import { Paragraph } from '@/shared/ui/paragraph'; | ||
import { SectionLabel } from '@/shared/ui/section-label'; | ||
|
||
import { WidgetTitle } from '@/shared/ui/widget-title'; | ||
|
||
import { merchData } from 'data'; | ||
|
||
import styles from './merch.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
export const Merch = () => ( | ||
<div id="merch" className={cx('container')}> | ||
<section id="merch" className={cx('container')}> | ||
<div className={cx('content', 'merch', 'column-2')}> | ||
<div className={cx('info')}> | ||
<SectionLabel>merch</SectionLabel> | ||
<WidgetTitle mods="asterisk">RS merch</WidgetTitle> | ||
<Paragraph fontSize="large">Are you an RS sloth fan and looking for RS merch?</Paragraph> | ||
<Paragraph> | ||
The wait is almost over as we're gearing up for the catalog of free web and print | ||
assets where you will find all merch collections and can print your own Rolling Scopes | ||
t-shirts, stickers etc. | ||
</Paragraph> | ||
<LinkCustom href={LINKS.MERCH} variant="primary" external> | ||
Discover merch assets | ||
</LinkCustom> | ||
</div> | ||
<Image className={cx('right', 'picture')} src={image} alt="speakers-wanted" /> | ||
<article className={cx('info')}> | ||
<SectionLabel>{merchData.label}</SectionLabel> | ||
<WidgetTitle mods="asterisk">{merchData.title}</WidgetTitle> | ||
<Paragraph fontSize="large">{merchData.mainParagraph}</Paragraph> | ||
<Paragraph>{merchData.description}</Paragraph> | ||
<LinkCustom href={LINKS.MERCH} variant="primary" external>{merchData.linkTitle}</LinkCustom> | ||
</article> | ||
<Image | ||
className={cx('image')} | ||
src={rsSchoolMerchImage} | ||
alt="A collage of photos with branded T-shirts, cups, and stickers featuring the RSSchool logo" | ||
data-testid="collage-with-merch" | ||
/> | ||
</div> | ||
</div> | ||
</section> | ||
); |
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.