Skip to content
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

Offer Link wrapper component in TSX #22807

Closed
brokenthorn opened this issue Sep 29, 2020 · 4 comments
Closed

Offer Link wrapper component in TSX #22807

brokenthorn opened this issue Sep 29, 2020 · 4 comments
Assignees

Comments

@brokenthorn
Copy link

@brokenthorn brokenthorn commented Sep 29, 2020

The styled and wrapped version of the Next.js Linkcomponent provided by the Material UI next-js template/example is not 100% usable in TypeScript projects because IntelliSense does not work with the current JavaScript version of the component. For example, there are no suggestions available for its props.

I converted the JS version to TSX partially. It is usable and IntelliSense works in VS-Code. I am missing just one more type, as far as I can tell. I've noted it with a TODO comment in this code gist.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

The Link component should be usable in other TSX components and provide IntelliSense in editors like VS-Code.

Examples 🌈

image

Motivation 🔦

I, like many others, prefer TypeScript over JavaScript and this is the only official starter template for Next.js + Material UI, but it is only JS-oriented. At the moment, the Next.js template only contains a few demo components which will be deleted anyway, but the Link component is usable. It would be great if there was a TSX version of it as well.

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 29, 2020

@brokenthorn I'm not sure to follow. Are you reporting an issue with?

// A styled version of the Next.js Link component:
// https://nextjs.org/docs/#with-link
function Link(props: LinkProps) {

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 29, 2020

I think that we can aim to link all the examples in https://next.material-ui.com/getting-started/example-projects/#official-examples, so do:

diff --git a/docs/src/pages/getting-started/example-projects/example-projects.md b/docs/src/pages/getting-started/example-projects/example-projects.md
index aba703ac5c..23d9424374 100644
--- a/docs/src/pages/getting-started/example-projects/example-projects.md
+++ b/docs/src/pages/getting-started/example-projects/example-projects.md
@@ -13,7 +13,6 @@ You can find some example projects in the [GitHub repository](https://github.com
 - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn)
 - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr)
 - [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-engine)
-- And more

 Create React App is an awesome project for learning React.
 Have a look at [the alternatives available](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) to see which project best fits your needs.
@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 29, 2020

@brokenthorn do you want to solve that?

@Avi98
Copy link
Contributor

@Avi98 Avi98 commented Oct 1, 2020

@oliviertassinari, I can take this issue if @brokenthorn is not looking into it.

Avi98 pushed a commit to Avi98/material-ui that referenced this issue Oct 5, 2020
@Avi98 Avi98 mentioned this issue Oct 5, 2020
1 of 1 task complete
Avi98 pushed a commit to Avi98/material-ui that referenced this issue Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.