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

header component implementation and examples #22

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

abu-seini-maf
Copy link

No description provided.

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.

Check comments and let's discuss

docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
docs/pages/components/mf-header.md Outdated Show resolved Hide resolved
@property({ type: String, reflect: true }) template: 'basic' | 'singleRow' | 'separateNavigation' = 'basic';

render() {
const isRtl = this.localize.dir() === 'rtl';

Choose a reason for hiding this comment

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

we should see if we can control if this code runs on the server or the browser to enable server side rendering

idea would be something like this

  let isRtl = false;
  if (inBrowser) {
    isRtl = this.localize.dir() === 'rtl';
  }

Copy link
Author

Choose a reason for hiding this comment

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

suggestion here is to adjust the localizeController to adapt to rtl params sent from the server on SSR, and not force inBrowser checks for the components, or we add a different controller to evaluate browser or server

export default class MfHeader extends ShoelaceElement {
static styles: CSSResultGroup = [componentStyles, styles];

private readonly localize = new LocalizeController(this);

Choose a reason for hiding this comment

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

this should be initialized only if we run this code in browser, localize should be LocalizeController | null

Copy link
Author

Choose a reason for hiding this comment

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

similar to previous comments

const isRtl = this.localize.dir() === 'rtl';

return html`
<header

Choose a reason for hiding this comment

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

Are we forcing html <header for this component?
In general I would not override html elements and if we do we should highlight on the documentation.
This will impact the demo page.

I think for this component has sense to use <header> so let's just add this into the doc

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.

To review in future PRs:

  • SSR Localization
  • use <header or not

@carlos-verdes
Copy link

LGTM and merging

@carlos-verdes carlos-verdes merged commit 9e7e172 into majidalfuttaim:next Nov 14, 2024
```html:preview
<mf-header style="max-width: 1400px;margin: 0 auto;" template="separateNavigation">
<mf-img slot="logo"
src="https://api-prod.thatconceptstore.com/medias/THATlogo.svg?context=bWFzdGVyfGltYWdlc3wxOTA1fGltYWdlL3N2Zyt4bWx8YURBNEwyZ3pPQzg1TkRNNE5EUTVNak00TURRMkwxUklRVlJzYjJkdkxuTjJad3xkMjhkOGMyODljNjEyMzlhODBkZDQzMGM0NDdiNzEzODljNjU0NWU1MmJlZDk3MjVkYTA5Y2Y1NDBiZGU1MzJi"

Choose a reason for hiding this comment

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

It’s better to use local images instead of linking to external resources to avoid potential issues with broken links or cross-site problems in the future. Please consider downloading the image and updating the src to point to a local path within the project.


<mf-img slot="logo" src="https://www.dev.mallgiftcard.ae/assets/maf-logo-header.svg" alt="MAF"></mf-img>

<mf-navigation slot="navigation">

Choose a reason for hiding this comment

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

Role="navigation" to be added

<mf-nav-item>
Neighbourhoods
<mf-navigation slot="subnav" vertical="true">
<mf-nav-item value="find">Serra</mf-nav-item>

Choose a reason for hiding this comment

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

aria-label to be added for each nav item

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.

3 participants