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

[Issue-126] :: Implement Disclosure component #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Chris-Blesson
Copy link

In this PR, I have implemented the Disclosure component in ember similar to the react headless UI component

I have added the relevant tests for the component functionality as well

I have also added the component to the docs

Please find the screen shots of the implementation
image
image

@Chris-Blesson
Copy link
Author

Hi @NullVoxPopuli can you help me with the review for this PR

Copy link
Collaborator

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

Left some questions, overall very nice work!

sorry it took so long to review!

@@ -0,0 +1,14 @@
<div
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need the wrapping div?



export default class Button extends Component {
guid = `${guidFor(this)}-tailwindui-disclosure-button`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use the guid helper instead of having a backing class?

template-only components are more performant

<Disclosure as |disclosure|>
<span class='rounded-md shadow-sm'>
<disclosure.Button
@index={{1}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we do we have index here? A consumer should never need to manage the index, yeah?

<button
type='button'
aria-haspopup={{true}}
aria-controls={{if @isOpen this.itemsGuid}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we generate a single GUID in the parent component, just to reduce the number of repeat guid creations?

passing a guid (and then concatting suffixes) allows us to then also get rid of data-test-selectors (we don't want to ship these to consumers either, but that's a current problem all over the addon that we need to fix -- out of scope for this PR)

export default class Panel extends Component {
panelGuid = `${guidFor(this)}-tailwindui-disclosure-panel`;

@tracked isOpen = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why does this have its own isOpen state when the parent component also has isOpen?

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