forked from rolling-scopes/site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rolling-scopes#536 from rolling-scopes/refactor/52…
…1-fsd-widget-communication 521-refactor: Fsd widget communication
- Loading branch information
Showing
7 changed files
with
167 additions
and
140 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export const communicationText = { | ||
en: { | ||
title: 'Communication', | ||
subTitle: 'Discord is the main communication channel in RS School', | ||
firstParagraphFirstHalf: 'Here is link for the ', | ||
discordLink: 'course Discord server', | ||
firstParagraphSecondHalf: ', where you can see latest news and chat with students.', | ||
secondParagraphFirstHalf: 'There are channels in ', | ||
telegramLink: 'Telegram', | ||
secondParagraphSecondHalf: | ||
' for discussing events related to your location. For example, offline lectures or just informal chats among students from the same location.', | ||
thirdParagraphFirstHalf: 'Please read the information about communication in RS School in the ', | ||
rsDocsLink: 'RS Docs', | ||
thirdParagraphSecondHalf: ', where you can find rules, descriptions of channels, FAQ.', | ||
}, | ||
ru: { | ||
title: 'Общение', | ||
subTitle: 'Дискорд — основной способ общения в RS School', | ||
firstParagraphFirstHalf: 'Вот ссылка на ', | ||
discordLink: 'Дискорд сервер курса', | ||
firstParagraphSecondHalf: | ||
', где вы можете посмотреть последние новости, задать вопросы и общаться со студентами.', | ||
secondParagraphFirstHalf: 'Также есть каналы в ', | ||
telegramLink: 'Телеграм', | ||
secondParagraphSecondHalf: | ||
' для обсуждения мероприятий, относящихся к вашему городу. Например, офлайн лекции или просто для общения студентов из одной локации.', | ||
thirdParagraphFirstHalf: 'Обязательно прочитайте информацию об общении в RS School в ', | ||
rsDocsLink: 'RS Docs', | ||
thirdParagraphSecondHalf: ', где вы можете найти правила, описание каналов, FAQ.', | ||
}, | ||
}; |
This file was deleted.
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,39 @@ | ||
.communication-content { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 26px; | ||
} | ||
|
||
.communication-wrapper { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 100px; | ||
align-items: center; | ||
justify-content: flex-start; | ||
|
||
@include media-tablet-large { | ||
flex-direction: column; | ||
gap: 40px; | ||
align-items: flex-start; | ||
} | ||
} | ||
|
||
.communication-paragraph { | ||
padding-top: 5px; | ||
} | ||
|
||
.discord-logo-wrapper { | ||
flex-shrink: 0; | ||
align-self: center; | ||
|
||
width: 250px; | ||
padding: 30px; | ||
|
||
background-color: hsl(234.9deg 85.6% 64.7%); | ||
border-radius: 30px; | ||
|
||
@include media-tablet { | ||
width: 150px; | ||
padding: 15px; | ||
} | ||
} |
This file was deleted.
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,53 @@ | ||
import { cleanup, screen } from '@testing-library/react'; | ||
import { Communication } from './communication'; | ||
import { renderWithRouter } from '@/shared/__tests__/utils'; | ||
import { DISCORD_LINKS, communicationText } from 'data'; | ||
|
||
describe('Communication section', () => { | ||
it.each([ | ||
{ | ||
languageProp: undefined, | ||
texts: communicationText.en, | ||
}, | ||
{ | ||
languageProp: 'en', | ||
texts: communicationText.en, | ||
}, | ||
{ | ||
languageProp: 'ru', | ||
texts: communicationText.ru, | ||
}, | ||
])( | ||
'should render component correctly with $languageProp language prop', | ||
({ languageProp, texts }) => { | ||
const firstCourse = Object.keys(DISCORD_LINKS)[0] as keyof typeof DISCORD_LINKS; | ||
|
||
const { title, subTitle, firstParagraphFirstHalf, discordLink } = texts; | ||
|
||
renderWithRouter(<Communication courseName={firstCourse} lang={languageProp as 'en' | 'ru' | undefined} />); | ||
const titleElement = screen.getByText(title); | ||
const subtitleElement = screen.getByText(subTitle); | ||
const firstParagraphElement = screen.getByText(`${firstParagraphFirstHalf}`, { exact: false }); | ||
const linkElement = screen.getByText(discordLink); | ||
|
||
expect(titleElement).toBeVisible(); | ||
expect(subtitleElement).toBeVisible(); | ||
expect(firstParagraphElement).toBeVisible(); | ||
expect(linkElement).toBeVisible(); | ||
expect(linkElement.getAttribute('href')).toMatch(DISCORD_LINKS[firstCourse]); | ||
cleanup(); | ||
}, | ||
); | ||
|
||
it.each(Object.entries(DISCORD_LINKS))( | ||
'should render correct link of %s course', | ||
(courseName, link) => { | ||
renderWithRouter(<Communication courseName={courseName as keyof typeof DISCORD_LINKS} />); | ||
const linkElement = screen.getByText(/course discord server/i); | ||
|
||
expect(linkElement).toBeVisible(); | ||
expect(linkElement.getAttribute('href')).toMatch(link); | ||
cleanup(); | ||
}, | ||
); | ||
}); |
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