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

Convert BsModal related classes to TS #2115

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SanderKnauff
Copy link
Contributor

WIP PR to track work of the conversion of BsModal and it's related components.

This also touches the bs-default and bs-noop helpers.

@SanderKnauff SanderKnauff marked this pull request as draft March 12, 2024 19:39
Copy link
Contributor

@jelhan jelhan left a comment

Choose a reason for hiding this comment

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

Just a few things I noticed skimming through it.

}}
{{else}}
{{#if (has-block)}}
{{yield}}
{{yield (hash title=Title close=Close)}}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to yield here. We are checking before of the block should receive parameters.

If Glimmer does not support that well, I think we should just remove the has-block-params code path. Simplifying the implementation may be good anyways. At least I don't see benefits in conditionally yuelding the component. I doubt that Embroider is able to detect it and tree-shake the child component if it's not needed.

@@ -0,0 +1,5 @@
export default function bsDefaultHelper<PRIMARY, SECONDARY>(
Copy link
Contributor

Choose a reason for hiding this comment

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

{{#let (ensure-safe-component (bs-default @buttonComponent (component "bs-button"))) as |Button|}}
<div class="modal-footer" ...attributes {{on "submit" (bs-default @onSubmit (bs-noop))}}>
{{#if (has-block)}}
{{yield}}
{{else}}
{{#if @submitTitle}}
<Button @onClick={{@onClose}}>{{bs-default @closeTitle "Ok"}}</Button>
<Button @type={{bs-default @submitButtonType "primary"}} onClick={{@onSubmit}} disabled={{bs-default @submitDisabled false}}>{{@submitTitle}}</Button>
<Button @type={{bs-default @submitButtonType "primary"}} @onClick={{@onSubmit}} disabled={{bs-default @submitDisabled false}}>{{@submitTitle}}</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

Is this causing a bug for consumers? If so, we may want to fix it in a separate PR and add missing test coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've addressed this in #2123. The missing @ does not seem to be breaking anything, but it is nicer to have it there just to be sure.

@jelhan jelhan mentioned this pull request Mar 12, 2024
32 tasks
@SanderKnauff SanderKnauff changed the title WIP: Convert BsModal related classes to TS Convert BsModal related classes to TS Apr 10, 2024
@SanderKnauff SanderKnauff marked this pull request as ready for review April 10, 2024 20:58
This commit includes:

* BsModal::Header::Close
* BsModal::Header::Title
* BsModal::Body
* BsModal::Footer
* BsModal::Header
@SanderKnauff SanderKnauff marked this pull request as draft April 13, 2024 21:04
@SanderKnauff
Copy link
Contributor Author

I've returned this PR to draft status as I found out I forgot some classes that need to be converted as well.
Probably why it was a draft PR in the first place. 😅

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.

None yet

2 participants