Skip to content

Commit

Permalink
Fixed rendering issue on NewsletterSubscribe & few button component o…
Browse files Browse the repository at this point in the history
…n community/tsc , community/events , community pages
  • Loading branch information
SahilDahekar committed Nov 12, 2024
1 parent 6be4dd2 commit 31e4b96
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 43 deletions.
39 changes: 7 additions & 32 deletions pages/community/events/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
/* eslint-disable react/no-unescaped-entities */
import { ArrowRightIcon } from '@heroicons/react/outline';
import React, { useState } from 'react';

import type { Event } from '@/types/pages/community/Community';
import { HeadingLevel, HeadingTypeStyle } from '@/types/typography/Heading';
import { ParagraphTypeStyle } from '@/types/typography/Paragraph';

import GoogleCalendarButton from '../../../components/buttons/GoogleCalendarButton';
import ICSFileButton from '../../../components/buttons/ICSFileButton';
import GenericLayout from '../../../components/layout/GenericLayout';
import Meeting from '../../../components/Meeting';
import EventFilter from '../../../components/navigation/EventFilter';
import EventPostItem from '../../../components/navigation/EventPostItem';
import NewsletterSubscribe from '../../../components/NewsletterSubscribe';
import Heading from '../../../components/typography/Heading';
import Paragraph from '../../../components/typography/Paragraph';
import TextLink from '../../../components/typography/TextLink';
import meetings from '../../../config/meetings.json';
import { getEvents } from '../../../utils/staticHelpers';
import CommunityEvents from '@/components/CommunityEvents';

import { makeStaticProps } from '@/utils/getStatic';
const getStaticProps = makeStaticProps(['landing-page', 'footer', 'common']);

export { getStaticProps };

/**
* @description This is the events page which displays all the events and meetings.
*/
export default function EventIndex() {
const image = '/img/social/community-events.webp';
const [events, setEvents] = useState(getEvents(meetings));

return (
<GenericLayout title='AsyncAPI events' description='Our catalogs of events and meetups' image={image} wide>
Expand Down Expand Up @@ -89,31 +88,7 @@ export default function EventIndex() {
</div>
</div>
</div>
<div className='mt-20'>
<div className='items-center justify-between sm:flex'>
<Heading level={HeadingLevel.h2} typeStyle={HeadingTypeStyle.md}>
All Events
</Heading>
<div className='mt-5 sm:mt-0'>
<EventFilter data={meetings} setData={setEvents} />
</div>
</div>
<div className='mt-10'>
{!events || events.length === 0 ? (
<div className='flex content-center justify-center'>
<Paragraph typeStyle={ParagraphTypeStyle.md} className='mx-auto mt-5 max-w-2xl'>
No Events. Check back later!
</Paragraph>
</div>
) : (
<ul className='grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3'>
{events.map((event: Event, index: number) => {
return <EventPostItem key={index} id={event.title} post={event} />;
})}
</ul>
)}
</div>
</div>
<CommunityEvents />
<div className='mt-24'>
<div className='lg:flex lg:justify-between' data-testid='EventTypesCard'>
<div className='lg:w-[30%]'>
Expand Down
5 changes: 5 additions & 0 deletions pages/community/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import NewsletterSubscribe from '../../components/NewsletterSubscribe';
import Heading from '../../components/typography/Heading';
import eventsData from '../../config/meetings.json';
import { getEvents } from '../../utils/staticHelpers';
import { makeStaticProps } from '@/utils/getStatic';

const getStaticProps = makeStaticProps(['common']);

export { getStaticProps };

interface Event {
title: string;
Expand Down
21 changes: 11 additions & 10 deletions pages/community/tsc.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { sortBy } from 'lodash';
import React, { useState } from 'react';

import type { Tsc } from '@/types/pages/community/Community';

Expand All @@ -10,6 +9,11 @@ import GenericLayout from '../../components/layout/GenericLayout';
import NewsletterSubscribe from '../../components/NewsletterSubscribe';
import TextLink from '../../components/typography/TextLink';
import TSCMembersList from '../../config/MAINTAINERS.json';
import { makeStaticProps } from '@/utils/getStatic';

const getStaticProps = makeStaticProps(['common']);

export { getStaticProps };

interface SocialLinkProps {
href: string;
Expand Down Expand Up @@ -66,11 +70,10 @@ function addAdditionalUserInfo(user: Tsc) {
* @returns The Twitter SVG component.
*/
function TwitterSVG() {
const [isHovered, setIsHovered] = useState(false);

return (
<div className='size-5' onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
<IconTwitter className={isHovered ? 'hover:fill-black' : ''} />
<div className='size-5'>
<IconTwitter className={'hover:fill-black'} />
</div>
);
}
Expand All @@ -81,11 +84,10 @@ function TwitterSVG() {
* @returns The GitHub SVG component.
*/
function GitHubSVG() {
const [isHovered, setIsHovered] = useState(false);

return (
<div className='size-5' onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
<IconGithub className={isHovered ? 'hover:fill-black' : ''} />
<div className='size-5'>
<IconGithub className={'hover:fill-black'} />
</div>
);
}
Expand All @@ -96,12 +98,11 @@ function GitHubSVG() {
* @returns The LinkedIn SVG component.
*/
function LinkedInSVG() {
const [isHovered, setIsHovered] = useState(false);

return (
<div className='size-5' onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
<div className='size-5'>
{/* Use the imported SVG icon component */}
<IconLinkedIn className={isHovered ? 'hover:fill-linkedin' : ''} />
<IconLinkedIn className={'hover:fill-linkedin'} />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion utils/getStatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const getStaticPaths = () => ({
* @returns An object containing the internationalization props.
*/
export async function getI18nProps(ctx: any, ns = ['common']) {
const locale = ctx?.params?.lang;
const locale = ctx?.params?.lang ? ctx?.params?.lang : 'en';
const props = {
...(await serverSideTranslations(locale, ns))
};
Expand Down

0 comments on commit 31e4b96

Please sign in to comment.