Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/vue-components/src/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>
<slot name="button">
<a
class="dropdown-toggle"
class="dropdown-toggle nav-link"
Copy link
Contributor

Choose a reason for hiding this comment

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

This component is also used by the navbar to create dropdowns.

As dropdown component in navbar already has nav-link class, the padding is applied here twice.

Notice how the links are no longer aligned on the navbar due to having extra paddings.
image

image

The relevant code:

<navbar type="primary">
  <!-- Brand as slot -->
  <a slot="brand" href="/" title="Home" class="navbar-brand">MarkBind</a>
  <li><a href="/userGuide/components/navigation.html#navbars" class="nav-link">Highlighted Link</a></li>
  <!-- You can use dropdown component -->
  <dropdown header="Dropdown" class="nav-link">
    <li><a href="#navbars" class="dropdown-item">Option</a></li>
  </dropdown>
  <!-- For right positioning use slot -->
  <li slot="right">
    <a href="https://github.com/MarkBind/markbind" target="_blank" class="nav-link">Fork...</a>
  </li>
</navbar>

Copy link
Contributor Author

@petermonky petermonky Nov 17, 2022

Choose a reason for hiding this comment

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

ahhh yes this is an issue, let me see if I can find a workaround for this 👍

Copy link
Contributor Author

@petermonky petermonky Nov 17, 2022

Choose a reason for hiding this comment

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

hi @jonahtanjz, I think it is okay to simply remove the nav-link classname from the dropdown element to remove the extra padding. i.e.

<navbar type="primary">
  <!-- Brand as slot -->
  <a slot="brand" href="/" title="Home" class="navbar-brand">MarkBind</a>
  <li><a href="/userGuide/components/navigation.html#navbars" class="nav-link">Highlighted Link</a></li>
  <!-- You can use dropdown component -->
  <dropdown header="Dropdown"> <!-- class="nav-link" removed -->
    <li><a href="#navbars" class="dropdown-item">Option</a></li>
  </dropdown>
  <!-- For right positioning use slot -->
  <li slot="right">
    <a href="https://github.com/MarkBind/markbind" target="_blank" class="nav-link">Fork...</a>
  </li>
</navbar>

the dropdown element element already wraps its anchor element with a nav-link anyway so I think the outer nav-link is safe to remove. I think this way the navbar elements would also be more consistent as the classname is only applied to the anchor elements within the navbar elements, dropdown or not:

image

I noticed that this would also affect the text colour of the anchor element and have accounted for it with another commit.

does this fix work, or is there a better approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this approach is fine but one main concern is that currently, most of the MarkBind sites will have the nav-link class in the dropdown component. If we go with this approach, users will have to remove the class on their end in the next release, which will be considered sort of a "breaking" change in the UI.

One workaround that you can do for now is to have an overriding CSS within Dropdown.vue to remove the padding from nav-link on the outer <li> element. This should ensure that there will not be extra padding with or without the nav-link class on the dropdown component. Once we are ready to make a release with breaking changes, we can then remove this workaround.

Note: You will need to update the user guide as well under navbar to remove the class.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if removing the nav-link class is the best way to go. Because that means that it won't use the bootstrap styling anymore and may not be consistent with the other elements that use the Bootstrap styling.

Should I still proceed to remove it anyway? @jonahtanjz

Copy link
Contributor

Choose a reason for hiding this comment

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

image
This is how tabs look like with the removal of the nav-link class from dropdown looks. Some styling can obviously be done but not sure it will be better than using the in built bootstrap

role="button"
:class="{'disabled': disabledBool}"
data-bs-toggle="dropdown"
Expand Down Expand Up @@ -230,7 +230,6 @@ export default {
}

.navbar .dropdown-toggle {
color: inherit;
text-decoration: none;
}
</style>
2 changes: 1 addition & 1 deletion packages/vue-components/src/Tabset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dropdown
v-else
:key="index"
class="nav-item nav-link"
class="nav-item"
:header="t.headerRendered"
:class="{active:t.active}"
:disabled="t.disabled"
Expand Down