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

Add styled-components with typescript example #1341

Merged
merged 1 commit into from
Apr 28, 2019
Merged

Add styled-components with typescript example #1341

merged 1 commit into from
Apr 28, 2019

Conversation

jorgeortega
Copy link
Contributor

Adding a simple example with styled-components and TypeScript

Copy link
Member

@sapegin sapegin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import styled from 'styled-components'

interface ButtonProps extends HTMLButtonElement {
btnType: 'primary' | 'secondary',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's simplify this a bit: rename a prop to variant and pass it to a styled component, so we don't duplicate the whole component markup twice.

Or just copy code here:
https://github.com/component-driven/component-driven-development/blob/master/src/components/core/Button/Button.js

path.resolve(__dirname, 'src'),
path.join(__dirname, 'node_modules')
],
extensions: ['.js', '.ts', '.tsx']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense to update the default extensions list:

extensions: ['.js', '.jsx', '.json'],

noParse: /\.(css|scss)/
},
resolve: {
modules: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

@@ -0,0 +1,14 @@
# React Styleguidist styled-components typescript example style guide
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's TypeScript.

@@ -0,0 +1,14 @@
# React Styleguidist styled-components typescript example style guide

See [deployed version](https://react-styleguidist.js.org/examples/styled-components/).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work, we only deploy basic example. But maybe we should deploy other examples too…

@jorgeortega
Copy link
Contributor Author

@sapegin Thanks for your feedback. All changes updated.

@sapegin sapegin merged commit 5334f43 into styleguidist:master Apr 28, 2019
@sapegin
Copy link
Member

sapegin commented Apr 28, 2019

Thanks!

@styleguidist-bot
Copy link
Collaborator

🎉 This PR is included in version 9.0.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants