-
Notifications
You must be signed in to change notification settings - Fork 21
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
Proposal/RFC for custom tag names #538
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,8 @@ | |
*/ | ||
import './index.scss'; | ||
|
||
const ContentButtonLayout = ( props ) => { | ||
const { className, ...rest } = props; | ||
|
||
return ( | ||
<div | ||
className={ `gla-content-button-layout ${ className }` } | ||
{ ...rest } | ||
/> | ||
); | ||
}; | ||
const ContentButtonLayout = ( props ) => ( | ||
<woo-gla-content-button-layout { ...props } /> | ||
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not sure if there is an easier way supported by react API to transform const cx = ( props ) => {
if ( props.hasOwnProperty( 'className' ) ) {
const { className, ...restProps } = props;
return { class: className, ...restProps };
}
return props;
};
<woo-gla-content-button-layout { ...cx( props ) } /> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this. Definitely, that's something we should be cautious about. The thing is, we are not using Web Components here. Therefore, I find it really strange that React does translate That means if we would have to attach React event listeners to Luckily, the children's elements are unaffected. So if we are about to cater only for a dummy We can also try const ContentButtonLayout = ( props ) => (
<wooglacontentbuttonlayout { ...props } />
); Then it's obvious that it's not a custom element. Then we do not need to open the "React vs. Web Standards" can of worms. |
||
); | ||
|
||
export default ContentButtonLayout; | ||
Comment on lines
3
to
10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got to say I like this, from 17 lines to 10 lines (and potentially even more for files that have imported and used |
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'm hoping / expecting this would work well with (possible future) CSS-in-JS solution, e.g. with emotion library (prior research: #71 ):
That would be great 🙂
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 haven't tried it with emotion. but I guess if emotion works for other elements
div, p, span
.I see no reason why it should work for all HTML elements.
For sure it works with native CSS-in-JS solution, like #539