-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
feat: migrate community components to typescript #2759
feat: migrate community components to typescript #2759
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
components/community/Card.tsx
Outdated
<Link href={link} target='_blank'> | ||
<a target={link.includes('http') ? '_blank' : undefined}> |
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.
Please follow this guide to either merge anchor with Link
or add legacyBehavior
prop to Link
component.
Do this for all such usages in this PR
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.
Done
components/community/Header.tsx
Outdated
// eslint-disable-next-line no-unused-vars, unused-imports/no-unused-vars | ||
className = '' |
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.
You can include className
prop to add className to the top-level div below.
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.
Done
components/community/Hero.tsx
Outdated
// eslint-disable-next-line no-unused-vars, unused-imports/no-unused-vars | ||
className = '' |
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.
You can include className prop to add className to the top-level div below
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.
Done
components/community/Header.tsx
Outdated
@@ -18,7 +18,7 @@ interface HeaderProps { | |||
export default function Header({ | |||
// eslint-disable-next-line no-unused-vars, unused-imports/no-unused-vars | |||
className = '' | |||
}: HeaderProps): JSX.Element { | |||
}: HeaderProps): React.ReactNode { |
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.
@anshgoyalevil We should not use React.ReactNode
here because it's being used inside the JSX in Hero.tsx
. Due to this, using React.ReactNode
is causing a build error.
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.
I have changed this back to JSX.Element
for now, let me know if there is any other option.
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.
Maybe you should then remove it all together, as suggested by Akshat
components/community/Hero.tsx
Outdated
*/ | ||
export default function Hero({ | ||
className = '' | ||
}: HeroProps): React.ReactNode { |
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.
}: HeroProps): React.ReactNode { | |
}: HeroProps) { |
Don't specify the return type of functional components, that are exported by default. It will be taken automatically by Typescript.
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.
Done
components/community/HomeCard.tsx
Outdated
|
||
> |
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.
Done
components/community/Header.tsx
Outdated
*/ | ||
export default function Header({ | ||
className = '' | ||
}: HeaderProps): JSX.Element { |
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.
}: HeaderProps): JSX.Element { | |
}: HeaderProps) { |
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.
Done
components/community/Card.tsx
Outdated
btnText, | ||
btnBg, | ||
link | ||
}: SmallHomeCardProp): React.ReactNode { |
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.
}: SmallHomeCardProp): React.ReactNode { | |
}: SmallHomeCardProp) { |
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.
Done
components/community/Card.tsx
Outdated
icon, | ||
tagline, | ||
taglineBg, | ||
type = 'large', |
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.
define enum for this type
in the types/community
folder.
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.
Done
components/community/Card.tsx
Outdated
* @param {string} props.btnBg - The background color for the button. | ||
* @param {string} props.link - The link for the button. | ||
*/ | ||
export default function SmallHomeCard({ |
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.
Why the component has been named as SmallHomeCard?
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.
This name is used in the master branch. But I think it will be more accurate to name it Card
. Also, it's not used anywhere in the master branch except for writing its own test.
components/community/HomeCard.tsx
Outdated
btnText, | ||
link, | ||
className | ||
} : HomeCardProp) : React.ReactNode { |
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.
} : HomeCardProp) : React.ReactNode { | |
} : HomeCardProp) { |
No need to define return type for the functional components.
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.
Sorry for this. I have rectified this now.
Description
This PR migrates the following components to TypeScript
Related issue(s)
#2636