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

Feat: Navigation Item component #15

Closed
wants to merge 0 commits into from

Conversation

abu-seini-maf
Copy link

added new Nav Item Component.
modified NAV Component.
Updated autoloader.

Copy link

@carlos-verdes carlos-verdes left a comment

Choose a reason for hiding this comment

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

I left couple of comments, most of it don't need change (are just observations)
I didn't go deep into controller logic as I prefer to merge this PR fast and do incremental changes, first thing as we agreed to add more CSS variables.

Apply the changes you may think are needed and fell free to merge.

@@ -0,0 +1,24 @@
window.addEventListener('load', function (event) {

Choose a reason for hiding this comment

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

I removed figma button as we need server side logic and the portal is static content only

@@ -53,6 +53,7 @@
<script src="{{ assetUrl('scripts/code-previews.js') }}" defer></script>
<script src="{{ assetUrl('scripts/lunr.js') }}" defer></script>
<script src="{{ assetUrl('scripts/search.js') }}" defer></script>
<script src="{{ assetUrl('scripts/figma-button.js') }}" defer></script>

Choose a reason for hiding this comment

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

I removed figma button as we need server side logic and the portal is static content only

@@ -80,6 +81,11 @@
<sl-icon name="twitter"></sl-icon>
</a>

{# Figma #}

Choose a reason for hiding this comment

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

same as before


### Prefix & Suffix

Add content to the start and end of nav items using the `prefix` and `suffix` slots.

Choose a reason for hiding this comment

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

Do we need this?
I would just add content before/after using this component

Copy link
Author

Choose a reason for hiding this comment

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

following the same structure and behavior of Shoelace, adding it within CSS will limit the usage of the Icons lib.

</mf-navigation>
```

### Highlight

Choose a reason for hiding this comment

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

I would use active as it's the most common word use for this

Copy link
Author

Choose a reason for hiding this comment

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

as discussed highlight have a different logic than active.


export default css`
:host {
--subnav-offset: -2px;

Choose a reason for hiding this comment

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

what is this for?

Copy link
Author

Choose a reason for hiding this comment

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

this to align the subnav with the parent while mitigating the space from borders.

cursor: not-allowed;
}

.nav-item.nav-item--highlight {

Choose a reason for hiding this comment

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

would change to active

line-height: var(--sl-line-height-normal);
letter-spacing: var(--sl-letter-spacing-normal);
color: var(--sl-color-neutral-700);
padding: var(--sl-spacing-2x-small) var(--sl-spacing-2x-small);

Choose a reason for hiding this comment

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

let's use this for naming convention:

.nav-item {
   /* ... */
  padding: var(--nav-spacing-inset-stretch, --nav-spacing-inset) var(--nav-spacing-inset-squish, --nav-spacing-inset);
  margin-right: var(--nav-spacing-inline);
  margin-bottom: var(--nav-spacing-stack);
}

.nav-item:dir(rtl) {
  margin-left: var(--nav-spacing-inline);
  margin-right: 0px !important;
}



<img width="756" alt="image" src="https://github.com/user-attachments/assets/e6d1aff4-550d-4635-9311-6c4580818692">

@@ -0,0 +1,161 @@
import { css } from 'lit';

Choose a reason for hiding this comment

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

I understand we need to add lot of custom variables at component level, I just added example for nav padding and margin following the space naming conventions I shared before

Comment on lines 4 to 10
describe('<mf-nav-item>', () => {
it('should render a component', async () => {
const el = await fixture(html` <mf-nav-item></mf-nav-item> `);

expect(el).to.exist;
});
});

Choose a reason for hiding this comment

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

amazing test :)

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