-
-
Notifications
You must be signed in to change notification settings - Fork 11
DRAFT 589-feat: Aws badge widgets #842
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fc80931
fix: remove specify property
YuliaDemir 1a32262
feat: move aws-badge to a separate widget
YuliaDemir 7d72ec5
fix: delete aws badge from the training programs
YuliaDemir e99fdfe
refactor: delete types isTrainingProgramType and TrainingProgramType
YuliaDemir 2233821
refactor: 589 - change the algorithm in the test
YuliaDemir 5b28b4e
fix: 589 - return the badge to the page
YuliaDemir ed1f3aa
refactor: 589 - combine the paragraph and heading test into one
YuliaDemir 0bebce8
feat: 589 - merge conflict
YulikK ae93bda
refactor: 589 - implement a general badge component instead of aws-badge
YuliaDemir db945f7
fix: 589 - merge to main
YuliaDemir a8d4f1f
feat: 589 - merge with main branch
YuliaDemir df58982
refactor: 589 - move badge to shared
YuliaDemir a715cdc
refactor: 589 - delete aws badge test and remove badge class name
YuliaDemir 50139b4
fix: 589 - merge into main
YuliaDemir 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.badge { | ||
gap: 176px; | ||
|
||
.badge-info { | ||
min-width: 640px; | ||
|
||
@include media-laptop { | ||
gap: 20px; | ||
min-width: 400px; | ||
} | ||
|
||
@include media-tablet { | ||
min-width: auto; | ||
} | ||
} | ||
|
||
.badge-img { | ||
width: 370px; | ||
height: 340px; | ||
|
||
@include media-tablet { | ||
width: 296px; | ||
height: 272px; | ||
} | ||
} | ||
|
||
@include media-laptop { | ||
gap: 50px; | ||
} | ||
|
||
@include media-tablet-large { | ||
gap: 32px; | ||
} | ||
} |
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,55 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { beforeEach, describe, expect, it } from 'vitest'; | ||
|
||
import { Badge } from './badge'; | ||
import type { StaticImageData } from 'next/image'; | ||
|
||
const mockImage: StaticImageData = { | ||
src: '/test-img.jpg', | ||
height: 100, | ||
width: 100, | ||
}; | ||
|
||
describe('Badge component', () => { | ||
const mockProps = { | ||
title: 'Badge Title', | ||
paragraphs: [ | ||
'Paragraph one', | ||
'Paragraph two', | ||
], | ||
image: mockImage, | ||
alt: 'Some description', | ||
}; | ||
|
||
beforeEach(() => { | ||
render(<Badge {...mockProps} />); | ||
}); | ||
|
||
it('renders the badge container', () => { | ||
const badge = screen.getByTestId('badge'); | ||
|
||
expect(badge).toBeVisible(); | ||
}); | ||
|
||
it('renders a title element', () => { | ||
const title = screen.getByText(mockProps.title); | ||
|
||
expect(title).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders all paragraph elements', () => { | ||
mockProps.paragraphs.forEach((text) => { | ||
const p = screen.getByText(text); | ||
|
||
expect(p).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
it('renders an image with correct alt and src attributes', () => { | ||
const image = screen.getByTestId('badge-img'); | ||
|
||
expect(image).toBeVisible(); | ||
expect(image).toHaveAttribute('alt', mockProps.alt); | ||
expect(image).toHaveAttribute('src', expect.stringContaining(mockImage.src)); | ||
}); | ||
}); |
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,43 @@ | ||
import classNames from 'classnames/bind'; | ||
import Image, { StaticImageData } from 'next/image'; | ||
|
||
import { Paragraph } from '@/shared/ui/paragraph'; | ||
import { WidgetTitle } from '@/shared/ui/widget-title'; | ||
|
||
import styles from './badge.module.scss'; | ||
|
||
type BadgeProps = { | ||
title: string; | ||
paragraphs: string[]; | ||
image: StaticImageData; | ||
alt: string; | ||
}; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
export const Badge = (data: BadgeProps) => { | ||
return ( | ||
<section | ||
className={cx('container')} | ||
data-testid="badge" | ||
> | ||
<div className={cx('content', 'column-2')}> | ||
<article className={cx('badge-info')}> | ||
<WidgetTitle mods="asterisk">{data.title}</WidgetTitle> | ||
{data.paragraphs.map((paragraph, index) => ( | ||
<Paragraph key={index}> | ||
{paragraph} | ||
</Paragraph> | ||
), | ||
)} | ||
</article> | ||
<Image | ||
className={cx('badge-img')} | ||
src={data.image} | ||
alt={data.alt} | ||
data-testid="badge-img" | ||
/> | ||
</div> | ||
</section> | ||
); | ||
}; |
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 @@ | ||
export { Badge } from './badge'; |
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 @@ | ||
export { AwsBadge } from './ui/aws-badge'; |
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,19 @@ | ||
import imageAws from '@/shared/assets/aws-cloud-pract-badge.webp'; | ||
import { Badge } from '@/shared/ui/badge'; | ||
|
||
export const AwsBadge = () => { | ||
return ( | ||
<Badge | ||
title="AWS DIGITAL BADGE" | ||
paragraphs={[ | ||
`Upon completing the course and passing the AWS Cloud Quest: Cloud Practitioner, you will | ||
obtain an AWS digital badge. This badge will recognize your achievement and demonstrate your | ||
knowledge of AWS fundamentals to potential employers or clients. By the end of the course, | ||
you will have gained a solid foundation in AWS fundamentals and be prepared to pass the AWS | ||
Cloud Practitioner certification.`, | ||
]} | ||
image={imageAws} | ||
alt="AWS Digital Badge" | ||
/> | ||
); | ||
}; |
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.
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.
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.
@ansivgit We should probably add a corresponding eslint rule