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

Buttonにcomponent propsを追加 #82

Merged
merged 1 commit into from
Jun 19, 2020

Conversation

youchann
Copy link
Contributor

close: #69

@youchann youchann added the enhancement New feature or request label Jun 17, 2020
@youchann youchann self-assigned this Jun 17, 2020
Comment on lines +23 to +32
const Link: React.FunctionComponent<{ href: string; className: string }> = ({
href,
className,
children,
}) => (
<a href={href} className={className} onClick={action("clicked")}>
{children}
</a>
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

使う側として気をつけないといけないのが、renderされる要素のtop-levelにclassNamepropを付与しないとスタイリングされないことです。

https://styled-components.com/docs/basics#styling-any-component

これに関してはButtonコンポーネントが干渉できない部分なので、使う側が気をつけないとなぁという感じですね。

Copy link
Contributor

@kinokoruumu kinokoruumu left a comment

Choose a reason for hiding this comment

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

LGTMです!
styled componentsのasにそんな罠があるとは...

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

Successfully merging this pull request may close these issues.

Buttonにcomponent propsを追加
2 participants