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

Support ref and element attribute #124

Closed

Conversation

8845musign
Copy link
Collaborator

@8845musign 8845musign commented Jul 25, 2024

Changes

  • All Components
    • allow ref prop
    • allow element attributes

Check

  • Added new Component
    • Added data-* prop and id prop
  • Updated Ubie Vitals or Added an update issue(if needed)

@8845musign 8845musign force-pushed the support-ref-and-element-attribute branch from 827d151 to b802964 Compare July 25, 2024 14:16
@8845musign 8845musign marked this pull request as ready for review August 8, 2024 07:21
@8845musign 8845musign marked this pull request as draft August 8, 2024 07:21
/**
* ラッパーであるdetails要素に付与するネイティブ要素の`id`属性。ページで固有のIDを指定
*/
id?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The prop of the native element, which we had dared to define for the sake of adding explanation, is deleted.

} else {
return <CenterCopmonent {...props}>{children}</CenterCopmonent>;
const Element = CenterComponent as ElementType;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is obvious that it is already the remaining ElementType here, since it is checked if it is a ReactElement above, but the type narrowing did not work


if (typeof (Element as unknown) !== 'string') {
// eslint-disable-next-line no-console
console.error('as prop only supports native elements or Box.');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Assuming that a specification like as={Stack} is made.
I can throw an error, but I don't want the application to stop working if it falls under the existing code

@8845musign 8845musign marked this pull request as ready for review August 8, 2024 10:20
@8845musign 8845musign marked this pull request as draft August 9, 2024 02:51
@8845musign
Copy link
Collaborator Author

Box has not yet been fixed.

@8845musign
Copy link
Collaborator Author

Closed due to no immediate needs

@8845musign 8845musign closed this Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant