Skip to content

Commit bc9fe4a

Browse files
committed
Removed all linting error
1 parent 6dec982 commit bc9fe4a

File tree

5 files changed

+170
-265
lines changed

5 files changed

+170
-265
lines changed

components/NewsletterSubscribe.tsx

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum FormStatus {
1717
NORMAL = 'normal',
1818
LOADING = 'loading',
1919
SUCCESS = 'success',
20-
ERROR = 'error',
20+
ERROR = 'error'
2121
}
2222

2323
interface NewsletterSubscribeProps {
@@ -46,12 +46,12 @@ export default function NewsletterSubscribe({
4646
title = 'Subscribe to our newsletter to receive news about AsyncAPI.',
4747
subtitle = 'We respect your inbox. No spam, promise ✌️',
4848
type = 'Newsletter',
49-
errorSubtitle = 'Subscription failed, please let us know about it by submitting a bug',
49+
errorSubtitle = 'Subscription failed, please let us know about it by submitting a bug'
5050
}: NewsletterSubscribeProps) {
5151
const [email, setEmail] = useState<string>('');
5252
const [name, setName] = useState<string>('');
5353
const [status, setStatus] = useState<FormStatus>(FormStatus.NORMAL);
54-
const [emailError, setEmailError] = useState<(error: string) => void>();
54+
const [setEmailError] = useState<(error: string) => void>();
5555

5656
const { t, ready } = useTranslation('common', { keyPrefix: 'newsletterCTA' });
5757

@@ -69,28 +69,30 @@ export default function NewsletterSubscribe({
6969
setStatus(FormStatus.LOADING);
7070
event.preventDefault();
7171

72-
//validate email
72+
// validate email
7373
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
74+
7475
if (!emailPattern.test(email)) {
7576
setEmailError('Invalid email address');
7677
setFormStatus(FormStatus.ERROR);
78+
7779
return;
7880
}
7981
setEmailError(''); // Clear error if valid
8082
setStatus(FormStatus.LOADING);
81-
//end
83+
// end
8284
const data = {
8385
name,
8486
email,
85-
interest: type,
87+
interest: type
8688
};
8789

8890
fetch('/.netlify/functions/newsletter_subscription', {
8991
method: 'POST',
9092
body: JSON.stringify(data),
9193
headers: {
92-
'Content-Type': 'application/json',
93-
},
94+
'Content-Type': 'application/json'
95+
}
9496
})
9597
.then((res) => {
9698
if (res.status === 200) {
@@ -107,16 +109,11 @@ export default function NewsletterSubscribe({
107109

108110
if (status === FormStatus.SUCCESS) {
109111
return (
110-
<div className={className} data-testid="NewsletterSubscribe-main">
111-
<Heading
112-
level={HeadingLevel.h3}
113-
textColor={headTextColor}
114-
typeStyle={HeadingTypeStyle.lg}
115-
className="mb-4"
116-
>
112+
<div className={className} data-testid='NewsletterSubscribe-main'>
113+
<Heading level={HeadingLevel.h3} textColor={headTextColor} typeStyle={HeadingTypeStyle.lg} className='mb-4'>
117114
{ready ? t('successTitle') : 'Thank you for subscribing!'}
118115
</Heading>
119-
<Paragraph className="mb-8" textColor={paragraphTextColor}>
116+
<Paragraph className='mb-8' textColor={paragraphTextColor}>
120117
{ready ? t('subtitle') : subtitle}
121118
</Paragraph>
122119
</div>
@@ -125,21 +122,13 @@ export default function NewsletterSubscribe({
125122

126123
if (status === FormStatus.ERROR) {
127124
return (
128-
<div className={className} data-testid="NewsletterSubscribe-main">
129-
<Heading
130-
level={HeadingLevel.h3}
131-
textColor={headTextColor}
132-
typeStyle={HeadingTypeStyle.lg}
133-
className="mb-4"
134-
>
125+
<div className={className} data-testid='NewsletterSubscribe-main'>
126+
<Heading level={HeadingLevel.h3} textColor={headTextColor} typeStyle={HeadingTypeStyle.lg} className='mb-4'>
135127
{ready ? t('errorTitle') : 'Something went wrong'}
136128
</Heading>
137-
<Paragraph className="mb-8" textColor={paragraphTextColor}>
129+
<Paragraph className='mb-8' textColor={paragraphTextColor}>
138130
{ready ? t('errorSubtitle') : errorSubtitle}{' '}
139-
<TextLink
140-
href="https://github.com/asyncapi/website/issues/new?template=bug.md"
141-
target="_blank"
142-
>
131+
<TextLink href='https://github.com/asyncapi/website/issues/new?template=bug.md' target='_blank'>
143132
{ready ? t('errorLinkText') : 'here'}
144133
</TextLink>
145134
</Paragraph>
@@ -148,48 +137,36 @@ export default function NewsletterSubscribe({
148137
}
149138

150139
return (
151-
<div className={className} data-testid="NewsletterSubscribe-main">
152-
<Heading
153-
level={HeadingLevel.h3}
154-
textColor={headTextColor}
155-
typeStyle={HeadingTypeStyle.lg}
156-
className="mb-4"
157-
>
140+
<div className={className} data-testid='NewsletterSubscribe-main'>
141+
<Heading level={HeadingLevel.h3} textColor={headTextColor} typeStyle={HeadingTypeStyle.lg} className='mb-4'>
158142
{ready ? t('title') : title}
159143
</Heading>
160-
<Paragraph className="mb-8" textColor={paragraphTextColor}>
144+
<Paragraph className='mb-8' textColor={paragraphTextColor}>
161145
{ready ? t('subtitle') : subtitle}
162146
</Paragraph>
163147
{status === 'loading' ? (
164-
<Loader
165-
loaderText={'Waiting for response...'}
166-
loaderIcon={<IconCircularLoader dark />}
167-
dark={dark}
168-
/>
148+
<Loader loaderText={'Waiting for response...'} loaderIcon={<IconCircularLoader dark />} dark={dark} />
169149
) : (
170-
<form
171-
className="flex flex-col gap-4 md:flex-row"
172-
onSubmit={handleSubmit}
173-
>
150+
<form className='flex flex-col gap-4 md:flex-row' onSubmit={handleSubmit}>
174151
<InputBox
175152
inputType={InputTypes.TEXT}
176-
inputName="name"
153+
inputName='name'
177154
placeholder={ready ? t('nameInput') : 'Your name'}
178155
inputValue={name}
179156
setInput={setName}
180157
/>
181158
<InputBox
182159
inputType={InputTypes.EMAIL}
183-
inputName="email"
160+
inputName='email'
184161
placeholder={ready ? t('emailInput') : 'Your email'}
185162
inputValue={email}
186163
setInput={setEmail}
187164
/>
188165
<Button
189166
type={ButtonType.SUBMIT}
190167
text={ready ? t('subscribeBtn') : 'Subscribe'}
191-
className="mt-2 w-full md:flex-1 md:mt-0 md:mr-2"
192-
href=""
168+
className='mt-2 w-full md:mr-2 md:mt-0 md:flex-1'
169+
href=''
193170
/>
194171
</form>
195172
)}

components/dashboard/Header.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22

3-
import Button from '../buttons/Button';
43
import GithubButton from '../buttons/GithubButton';
54
import SlackButton from '../buttons/SlackButton';
65

@@ -9,26 +8,23 @@ import SlackButton from '../buttons/SlackButton';
98
*/
109
export default function Header() {
1110
return (
12-
<div className="sm:flex sm:justify-between" id="main-content">
13-
<div className="lg:flex lg:justify-between">
14-
<div className="max-w-xl">
11+
<div className='sm:flex sm:justify-between' id='main-content'>
12+
<div className='lg:flex lg:justify-between'>
13+
<div className='max-w-xl'>
1514
<h2
16-
className="text-4xl font-extrabold leading-10 text-gray-900 sm:text-4xl sm:tracking-tight sm:leading-none"
17-
data-testid="Header-heading"
15+
className='text-4xl font-extrabold leading-10 text-gray-900 sm:text-4xl sm:leading-none sm:tracking-tight'
16+
data-testid='Header-heading'
1817
>
1918
Dashboard
2019
</h2>
21-
<p
22-
className="mt-5 text-xl leading-7 text-gray-700"
23-
data-testid="Header-paragraph"
24-
>
20+
<p className='mt-5 text-xl leading-7 text-gray-700' data-testid='Header-paragraph'>
2521
Visualize our progress. Get involved.{' '}
2622
</p>
2723
</div>
2824
</div>
29-
<div className="flex flex-col gap-y-1 gap-x-2 self-end mt-3 text-center xs:flex-row">
30-
<GithubButton text="View on Github" className="lg:mt-0" />
31-
<SlackButton className="lg:mt-0" />
25+
<div className='mt-3 flex flex-col gap-x-2 gap-y-1 self-end text-center xs:flex-row'>
26+
<GithubButton text='View on Github' className='lg:mt-0' />
27+
<SlackButton className='lg:mt-0' />
3228
</div>
3329
</div>
3430
);

components/navigation/BlogPostItem.tsx

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface BlogPostItemProps {
3131
*/
3232
export default forwardRef(function BlogPostItem(
3333
{ post, className = '', id = '' }: BlogPostItemProps,
34-
ref: Ref<HTMLLIElement> /** Reference object for the component. */,
34+
ref: Ref<HTMLLIElement> /** Reference object for the component. */
3535
) {
3636
let typeColors: [string, string] = ['bg-indigo-100', 'text-indigo-800'];
3737

@@ -57,25 +57,17 @@ export default forwardRef(function BlogPostItem(
5757
ref={ref}
5858
id={id}
5959
>
60-
<article className="h-full rounded-lg border border-gray-300 shadow-md hover:border-gray-400 hover:shadow-xl">
60+
<article className='h-full rounded-lg border border-gray-300 shadow-md hover:border-gray-400 hover:shadow-xl'>
6161
<Link href={post.slug}>
62-
<span className="flex overflow-hidden flex-col h-full rounded-lg divide-y divide-gray-200 cursor-pointer">
62+
<span className='flex h-full cursor-pointer flex-col divide-y divide-gray-200 overflow-hidden rounded-lg'>
6363
{/* Blog Image */}
64-
<img
65-
className="object-cover w-full h-48"
66-
src={post.cover}
67-
alt={post.title}
68-
loading="lazy"
69-
/>
64+
<img className='h-48 w-full object-cover' src={post.cover} alt={post.title} loading='lazy' />
7065

7166
{/* Blog Content */}
72-
<div className="flex flex-col flex-1 justify-between p-6 bg-white md:p-8">
73-
<div className="flex-1">
67+
<div className='flex flex-1 flex-col justify-between bg-white p-6 md:p-8'>
68+
<div className='flex-1'>
7469
{/* Blog Type Badge */}
75-
<Paragraph
76-
typeStyle={ParagraphTypeStyle.sm}
77-
textColor="text-indigo-500"
78-
>
70+
<Paragraph typeStyle={ParagraphTypeStyle.sm} textColor='text-indigo-500'>
7971
<span
8072
className={`inline-flex items-center rounded-full px-3 py-0.5 ${typeColors[0]} ${typeColors[1]}`}
8173
>
@@ -84,45 +76,32 @@ export default forwardRef(function BlogPostItem(
8476
</Paragraph>
8577

8678
{/* Blog Title */}
87-
<Heading
88-
level={HeadingLevel.h5}
89-
typeStyle={HeadingTypeStyle.smSemibold}
90-
className="mt-3"
91-
>
79+
<Heading level={HeadingLevel.h5} typeStyle={HeadingTypeStyle.smSemibold} className='mt-3'>
9280
{post.title}
9381
</Heading>
9482

9583
{/* Blog Excerpt */}
96-
<Paragraph
97-
typeStyle={ParagraphTypeStyle.sm}
98-
className="mt-4 text-gray-600"
99-
>
100-
<TextTruncate element="span" line={4} text={post.excerpt} />
84+
<Paragraph typeStyle={ParagraphTypeStyle.sm} className='mt-4 text-gray-600'>
85+
<TextTruncate element='span' line={4} text={post.excerpt} />
10186
</Paragraph>
10287
</div>
10388

10489
{/* Author & Date */}
105-
<div className="flex items-center mt-6">
106-
<div className="relative shrink-0">
90+
<div className='mt-6 flex items-center'>
91+
<div className='relative shrink-0'>
10792
<AuthorAvatars authors={post.authors} />
10893
</div>
109-
<div className="ml-3">
110-
<Heading
111-
level={HeadingLevel.h3}
112-
typeStyle={HeadingTypeStyle.xsSemibold}
113-
textColor="text-gray-900"
114-
>
94+
<div className='ml-3'>
95+
<Heading level={HeadingLevel.h3} typeStyle={HeadingTypeStyle.xsSemibold} textColor='text-gray-900'>
11596
{post.authors.map((author, index) => (
116-
<span key={index} className="hover:underline">
97+
<span key={index} className='hover:underline'>
11798
{author.name}
11899
</span>
119100
))}
120101
</Heading>
121-
<Paragraph typeStyle={ParagraphTypeStyle.sm} className="flex">
122-
<time dateTime={post.date}>
123-
{moment(post.date).format('MMMM D, YYYY')}
124-
</time>
125-
<span className="mx-1">&middot;</span>
102+
<Paragraph typeStyle={ParagraphTypeStyle.sm} className='flex'>
103+
<time dateTime={post.date}>{moment(post.date).format('MMMM D, YYYY')}</time>
104+
<span className='mx-1'>&middot;</span>
126105
<span>{post.readingTime} min read</span>
127106
</Paragraph>
128107
</div>

0 commit comments

Comments
 (0)