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

fix: ui fix for labels of sidebarNavItem #921

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

JabSYsEmb
Copy link
Contributor

The labels of sidebarNavItem were erroneously displaying underlines despite having the no-underline class applied.

The no-underline class alone was not affecting the span element's style as expected. This is because the text-decoration property was being inherited from the parent element. By setting the display property of the label to "inline-block", we prevent it from inheriting the underline style when the anchor is hovered over.

before
Screenshot 2024-03-19 at 22 04 56

after
image

Copy link

changeset-bot bot commented Mar 19, 2024

⚠️ No Changeset found

Latest commit: b19959f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

github-actions bot commented Mar 19, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
shadcn-svelte ✅ Ready (View Log) Visit Preview b19959f

@JabSYsEmb JabSYsEmb changed the title Fix: ui fix for labels of sidebarNavItem fix: ui fix for labels of sidebarNavItem Mar 19, 2024
@huntabyte
Copy link
Owner

Hey there, the underline seems to be spanning beyond the word by a character!

@JabSYsEmb
Copy link
Contributor Author

a whitespace is added between the label and the text of the anchor element but I am not sure why it's added let me try to fix that also
image

@JabSYsEmb
Copy link
Contributor Author

hey,

There is two options to get rid of the whitespace after the text which are the following:

  • wrap the {item.title} with a span element and set its margin right to -4px as here:
// ...
>
					<span class="-me-1">{item.title}</span>
					{#if item.label}
// ....
  • to remove the space between html elements as follow:
// ....
				>
					{item.title}{#if item.label}
						<span
							class="ml-2 inline-block self-center rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000]"
						>
// ....

I quote from a website:
" A common problem when using inline-block elements is that whitespace in HTML becomes visual space in the site design (similar to having space between words). " resource

Which solutions do you think are more suitable in this situation?

@huntabyte
Copy link
Owner

The space is fine, we just don't want it underlined. If we wrap the title in a span and apply the underline class to that it should work right?

Copy link
Owner

@huntabyte huntabyte left a comment

Choose a reason for hiding this comment

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

Thank you!

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