Skip to content

Commit

Permalink
add t for blog section
Browse files Browse the repository at this point in the history
Signed-off-by: Ansh Goyal <[email protected]>
  • Loading branch information
anshgoyalevil committed Aug 13, 2023
1 parent bce0ad6 commit 2cd66ea
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 15 deletions.
8 changes: 6 additions & 2 deletions components/buttons/GoogleCalendarButton.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import Button from './Button';
import IconGoogleCalendar from '../icons/GoogleCalendar';
import { useTranslation } from '../../lib/i18n';

export default function GoogleCalendarButton({
text = 'Add to Google Calendar',
text = 'googleCalendarBtn',
href,
target = '_blank',
iconPosition = 'left',
className,
}) {

const { t } = useTranslation('common');

return (
<Button
text={text}
text={t(text)}
icon={<IconGoogleCalendar />}
href={href}
iconPosition={iconPosition}
Expand Down
8 changes: 6 additions & 2 deletions components/buttons/ICSFileButton.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import Button from './Button';
import IconCalendar from '../icons/Calendar';
import { useTranslation } from '../../lib/i18n';

export default function ICSFButton({
text = 'Download ICS File',
text = 'icsFileBtn',
href,
target = '_blank',
iconPosition = 'left',
className,
}) {

const { t } = useTranslation('common');

return (
<Button
text={text}
text={t(text)}
icon={<IconCalendar />}
href={href}
iconPosition={iconPosition}
Expand Down
8 changes: 6 additions & 2 deletions components/buttons/SubscribeButton.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import Button from './Button';
import IconSubscribe from '../icons/Subscribe';
import { useTranslation } from '../../lib/i18n';

export default function GoogleCalendarButton({
text = 'Subscribe',
text = 'subscribeBtn',
href,
target = '_blank',
iconPosition = 'left',
className,
}) {

const { t } = useTranslation('common');

return (
<Button
text={text}
text={t(text)}
icon={<IconSubscribe />}
href={href}
iconPosition={iconPosition}
Expand Down
10 changes: 7 additions & 3 deletions components/newsroom/NewsroomSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import Paragraph from '../typography/Paragraph';
import Button from '../buttons/Button';
import Link from 'next/link';
import { getAllPosts } from '../../lib/api';
import { useTranslation } from '../../lib/i18n';

export default function NewsroomSection() {

const { t } = useTranslation('common');

const posts = getAllPosts()['blog']
.sort((i1, i2) => {
const i1Date = new Date(i1.date);
Expand All @@ -26,13 +30,13 @@ export default function NewsroomSection() {
</section>
<section className="lg:text-left lg:max-w-xl lg:w-1/2 lg:ml-12 mt-5 lg:my-auto" data-testid="NewsroomSection-main">
<Heading typeStyle="heading-md-semibold" level="h3">
Latest news and blogs
{t("newsroomSection.title")}
</Heading>
<Paragraph typeStyle="body-lg" className="mt-5">
Welcome to our Newsroom section. Here, you'll get latest information about our blogs, articles, announcements and Youtube live-streams. Let's get upto date with the recent activities in the organization.
{t("newsroomSection.description")}
</Paragraph>
<div className='mt-7' >
<Button text='Visit the Newsroom' href='/community/newsroom' data-testid="NewsroomSection-Link"/>
<Button text={t("newsroomSection.newsroomBtn")} href='/community/newsroom' data-testid="NewsroomSection-Link"/>
</div>
</section>
</div>
Expand Down
2 changes: 1 addition & 1 deletion cypress/test/buttons/GoogleCalendarButton.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import GoogleCalendarButton from '../../../components/buttons/GoogleCalendarButt
describe('GoogleCalendarButton', () => {
it('renders correctly with default props', () => {
mount(<GoogleCalendarButton />);
cy.contains('Add to Google Calendar').should('be.visible');
cy.contains('googleCalendarBtn').should('be.visible');
});

it('renders correctly with custom props', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/test/buttons/ICSFileButton.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ describe('ICSFButton', () => {

it('renders correctly with default props', () => {
mount(<ICSFButton />);
cy.contains('Download ICS File').should('be.visible');
cy.contains('icsFileBtn').should('be.visible');
});
});
2 changes: 1 addition & 1 deletion cypress/test/buttons/SubscribeButton.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SubscribeButton from '../../../components/buttons/SubscribeButton';
describe('Subscribe Button', () => {
it('renders correctly with default props', () => {
mount(<SubscribeButton/>);
cy.contains('Subscribe').should('be.visible');
cy.contains('subscribeBtn').should('be.visible');

});

Expand Down
2 changes: 1 addition & 1 deletion cypress/test/newsroom/NewsroomSection.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mount } from 'cypress/react'
import NewsroomSection from '../../../components/newsroom/NewsroomSection';
const newsroom = ["Latest news and blogs"]
const newsroom = ["newsroomSection.title"]
describe('Newsroom Section Component', () => {
beforeEach(() => {
mount(<NewsroomSection />);
Expand Down
10 changes: 9 additions & 1 deletion locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
"nameInput": "Ihr Name",
"emailInput": "Deine E-Mail",
"subscribeBtn": "Abonnieren"
}
},
"newsroomSection": {
"title": "Aktuelle Nachrichten und Blogs",
"description": "Willkommen in unserem Newsroom-Bereich. Hier finden Sie die neuesten Informationen über unsere Blogs, Artikel, Ankündigungen und Youtube-Livestreams. Informieren Sie sich über die jüngsten Aktivitäten der Organisation.",
"newsroomBtn": "Besuchen Sie den Newsroom"
},
"googleCalendarBtn": "Zu Google Kalender hinzufügen",
"subscribeBtn": "Abonnieren",
"icsFileBtn": "ICS-Datei herunterladen"
}
10 changes: 9 additions & 1 deletion locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
"nameInput": "Your name",
"emailInput": "Your email",
"subscribeBtn": "Subscribe"
}
},
"newsroomSection": {
"title": "Latest news and blogs",
"description": "Welcome to our Newsroom section. Here, you'll get latest information about our blogs, articles, announcements and Youtube live-streams. Let's get upto date with the recent activities in the organization.",
"newsroomBtn": "Visit the Newsroom"
},
"googleCalendarBtn": "Add to Google Calendar",
"subscribeBtn": "Subscribe",
"icsFileBtn": "Download ICS File"
}

0 comments on commit 2cd66ea

Please sign in to comment.