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

Expose secondary block and character counter from ToucanForm for Input and Textarea #222

Merged
merged 3 commits into from
Jul 20, 2023

Conversation

ynotdraw
Copy link
Contributor

🚀 Description

  • Adds secondary block to Input and Textarea

🔬 How to Test

  • Green build should be enough since there are tests!

📸 Images/Videos of Functionality

N/A

@ynotdraw ynotdraw self-assigned this Jul 20, 2023
@changeset-bot
Copy link

changeset-bot bot commented Jul 20, 2023

🦋 Changeset detected

Latest commit: ff50f27

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@crowdstrike/ember-toucan-form Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +33 to +34
"@docfy/core": "^0.6.0",
"@docfy/ember": "^0.6.0",
Copy link
Contributor Author

@ynotdraw ynotdraw Jul 20, 2023

Choose a reason for hiding this comment

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

I had to bump these down as I was getting build errors (randomly) from docfy when running:

pnpm build

or

pnpm start

It's apparently not failing on CI though, which is weird. It was bumped by Renovate yesterday.

I didn't see a helpful error as to why, so I figure reverting for the time being is the path of least resistance. I'll pick this back up after other items come off of my plate.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was my PR that was part of the bump to version 0.7.0: josemarluedke/docfy#161

But there were also a lot of 3 dependabot updates...https://github.com/josemarluedke/docfy/pulls?q=is%3Apr+is%3Aclosed

@github-actions
Copy link
Contributor

github-actions bot commented Jul 20, 2023

Preview URLs

Env: preview
Docs: https://2c1dfbe9.ember-toucan-core.pages.dev

@ynotdraw ynotdraw marked this pull request as ready for review July 20, 2023 18:34
@ynotdraw ynotdraw force-pushed the expose-secondary-block branch from 907266e to b38ac3c Compare July 20, 2023 18:36
A character counter is exposed via a `secondary` block. It can be combined with any of the other named blocks or label/hint arguments.

```hbs
<Form::Fields::Input class='w-full' @label='Label' @hint='With hint text'>
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀 Thanks for adding this in!

...attributes
>
<:label>{{yield to='label'}}</:label>
<:secondary as |secondary|>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a (has-block 'secondary') wrapped around it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sent a message about this, but we cannot conditionally render named blocks, so we have no way to do:

<Form::Fields::Textarea
  @hint={{@hint}}
  @error={{this.mapErrors field.rawErrors}}
  @value={{this.assertString field.value}}
  {{! @glint-expect-error }}
  @onChange={{field.setValue}}
  @isDisabled={{@isDisabled}}
  @isReadOnly={{@isReadOnly}}
  @rootTestSelector={{@rootTestSelector}}
  name={{@name}}
  ...attributes
>
  <:label>{{yield to='label'}}</:label>
  
  {{#if (has-block "secondary")}}
    <:secondary as |secondary|>
  {{/if}}

So due to that we have the top-level {{#if (has-block 'secondary')}}

<secondary.CharacterCount @max={{255}} />
</:secondary>
</Form::Fields::Textarea>
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: it would be nice to have this in the changeset demo...maybe as a follow up.

But then again, we don't have analytics (do we?) so we don't know which docs folks are looking at the most as an example...

Copy link
Contributor Author

@ynotdraw ynotdraw Jul 20, 2023

Choose a reason for hiding this comment

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

Yeah! Good suggestion! I was going to add this in the docs later. There's an issue I filed around maybe making components all full-width, otherwise the demo looks kinda funky. I'll work on this next week hopefully though!

@ynotdraw ynotdraw merged commit e398be0 into main Jul 20, 2023
@ynotdraw ynotdraw deleted the expose-secondary-block branch July 20, 2023 21:31
@github-actions github-actions bot mentioned this pull request Jul 19, 2023
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.

2 participants