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

bug: Collapse with icon, Arrow is jumping but plus/minus icon seems ok #2725

Open
OlegSuncrown opened this issue Jan 3, 2024 · 5 comments
Open

Comments

@OlegSuncrown
Copy link

OlegSuncrown commented Jan 3, 2024

What version of daisyUI are you using?

v4.5.0

Which browsers are you seeing the problem on?

Chrome

Reproduction URL

https://play.tailwindcss.com/EqKz1x2vVS

Describe your issue

Collapse with checkbox and icon with more content has Arrow Icon what is jumping but plus/minus icon seems ok.
In the Arrow Icon: .collapse-arrow > .collapse-title:after { top: 50% } that's why animations is weird, but it properly centered.
In the .collapse-plus > .collapse-title:after { top: 0.9rem; } that's why it looks ok.

Maybe something like this: https://play.tailwindcss.com/i2LKgeYQ1o?file=css

.collapse-title {
    min-height: 2.5rem;
}

.collapse:not(.collapse-close):has(> input[type=checkbox]:checked), .collapse:not(.collapse-close):has(> input[type=radio]:checked) {
    grid-template-rows: 2.5rem 1fr;
}

.collapse {
    grid-template-rows: 2.5rem 0fr;
}
Copy link

github-actions bot commented Jan 3, 2024

Thank you @OlegSuncrown for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

Nekxio added a commit to Nekxio/daisyui that referenced this issue Jan 5, 2024
@Nekxio
Copy link
Contributor

Nekxio commented Jan 5, 2024

Hello @OlegSuncrown 😄
I'm taking a look at it right now. I think to stay as adaptive as possible, without changing everything that has been done for the collapse, is to change top position of the arrow icon. This is consistent with the collapse "arrow plus/minus icon".
I'm open to other proposals until the PR is reviewed 😉

Nekxio added a commit to Nekxio/daisyui that referenced this issue Jan 5, 2024
@ClassicOldSong
Copy link

This fix caused the arrow being not centered when the title bar is not the default height.

@saadeghi saadeghi reopened this Feb 7, 2024
@Nekxio
Copy link
Contributor

Nekxio commented Feb 11, 2024

Thanks for your feedback, I'll take a look and suggest another solution.

@Nekxio
Copy link
Contributor

Nekxio commented Feb 11, 2024

After trying different approaches, I can't seem to solve the problem. I've noticed that my first idea solved the problem, but it's no longer centered. However, when the top is defined as a percentage, the problem persists. Looking for another solution, I found that by placing the svg in the dom, we could probably align the text and arrow without the problem of displacement when rotating. This involves changing the architecture of the component.
Moreover, the component with the plus/minus icon isn't centered either when the title is longer.

If anyone can find a simpler solution, I'd be very interested. 😄

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

No branches or pull requests

4 participants