Tips for designing a navbar specific to a profile section

I am currently working on an angular application with a navigation bar composed of anchor tags. When the user logs in, I have an ngIf directive to display my profile icon with dropdown options. However, I am facing challenges in styling it correctly. I aim to have a spanner icon on the top right of the navigation bar that, when clicked, shows the available options. This is what I have implemented so far:

<div class="page-links responsive" [ngClass]="{'animate': shouldShow}">
  <a [routerLink]="''"
     [routerLinkActive]="'active'"
     [routerLinkActiveOptions]="{exact: true}"
     draggable="false"
     (click)="toggleMenu()">
    Home
  </a>
  <a [routerLink]="'/university'"
     [routerLinkActive]="'active'"
     draggable="false"
     (click)="toggleMenu()">
    University Cup
  </a>
  <a [routerLink]="'/rules'"
     [routerLinkActive]="'active'"
     draggable="false"
     (click)="toggleMenu()">
    The Game
  </a>
  <a [routerLink]="'/tournaments'"
     [routerLinkActive]="'active'"
     draggable="false"
     (click)="toggleMenu()">
    Tournaments
  </a>
  <a [routerLink]="'/history'"
     [routerLinkActive]="'active'"
     draggable="false"
     (click)="toggleMenu()">
    Our Legacy
  </a>
  <a [routerLink]="'/team'"
     [routerLinkActive]="'active'"
     draggable="false"
     (click)="toggleMenu()">
    Our Team
  </a>
  <a [routerLink]="'/portal'"
     [routerLinkActive]="'active'"
     draggable="false"
     (click)="toggleMenu()">
    Player Portal
</a>
  <a *ngIf="isAuthed">
    <mat-form-field appearance="fill">
      <mat-label><mat-icon>accessibility</mat-icon></mat-label>
      <mat-select>
        <mat-option value="option1">My Profile</mat-option>
        <mat-option value="option2">GitHub Instructions</mat-option>
        <mat-option value="option3">Download CICD file</mat-option>
        <mat-option value="option4">Logout</mat-option>
      </mat-select>
    </mat-form-field>
  </a>
</div>

This is how I have styled it using CSS:

.page-links {
  @media (max-width: $screen-md-max) {
    position: absolute;
    top: 80px;
    right: 0;
    left: 0;
  }

  a {
    /* Styling for anchor tags */
  }

  li {
    /* Styling for list items */
  }

  &.responsive {
    @media (max-width: $screen-md-max) {
      /* Responsive styles */
    }
  }
}

The rendered code looks like this: Rendered Code

I am encountering rendering issues. Any suggestions on how I can resolve this?

Answer №1

To enhance the layout, include two additional divs with distinct classes and style them using CSS for a polished appearance.

    <div class="left-menu">
        <a>About Us</a>
        <a>Services</a>
        <a>Products</a>
        <a>Contact Us</a>
    </div>
    <div class="right-menu">
        <a *ngIf="isLoggedIn">
            <mat-form-field></mat-form-field>
        </a>
    </div>
</div>
<style>
    .left-menu{
        float: left;
        width:80%;
    }
    .right-menu {
        float: left;
        width: 20%;
    }
</style>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error in Angular integrating with Stripe. No definition found for 'Stripe'. Perhaps you meant 'stripe'?

I'm currently in the process of connecting Stripe to my app with redirection, utilizing Angular and typescript. My component contains the following code snippet: var head = document.getElementsByTagName('head')[0]; var script = document.cre ...

Achieve sliding animations with Pure CSS using slideUp and slideDown techniques

Currently, I have implemented a code snippet to showcase a menu along with displaying submenus upon hovering over the main menus. Now, I am looking to introduce some animation effects for the submenus when they appear, similar to the slideUp and slideDown ...

Adjusting the size of an image based on the size of the window

I'm currently working on my first website project. I have successfully implemented a large image banner, however, I am facing an issue with setting its height. Whenever I try to adjust the height using percentage values, the banner disappears. My goal ...

Dynamic styling with Angular's @Component decorator allows for the seamless application of styles

Angular 13 In my @Component, I am trying to set up dynamic values for the styles, but it is not working. styles: [ ` .k-daterangepicker .k-dateinput { width: {{myWidth}}; } `, ], What is the correct way to change the . ...

"Exploring the concept of responsive design: understanding the distinction between media query width and actual

Apologies for the lengthy description, but I want to provide as much detail as possible. I recently encountered an issue (which I managed to resolve, but the root cause eluded me). The crux of the problem was that when resizing the browser, specificall ...

The JQuery loading symbol does not prevent keyboard interactions

I successfully implemented a Jquery busy indicator in my application using the following link: However, I noticed that even though it prevents users from clicking on input elements while loading, I can still navigate to these elements by pressing the tab ...

"Text data will be automatically cut at the end of a page and continue

I encountered the following issue As depicted in the image The data is not being displayed properly In the next td, the last character 3 is also printed on the next line Is it possible to avoid page footer and header without adjusting the page margin? ...

Fluctuating problem arises when placing one div over another div while hovering

Sorry if the title isn't clear. Basically, I have a div that when hovered over, triggers another div to appear with display:block, showing it above the original div. It works well but there is some flickering when moving the cursor over the second div ...

Angular6 ng test is not successful

I recently upgraded my project from Angular4 to version 6. Everything seems to be working fine, except for the issue with running ng test: ERROR [karma-server]: Server start failed on port 9876: Error: No provider for "framework:@angular/cli"! (Resolving ...

Component-specific provider registration in Angular

Registering a provider at the component level results in a new instance of the service being created for each new instance of that component. The service becomes an instance variable of the component object, making it a dependency. This dependency can be i ...

Issues with SVG Image Mask in Firefox and IE: How to Fix Them

Creating a mask with a PNG (black circle, transparent background) and using -webkit-mask-image:url(images/mask.png) has been easy for browsers like Chrome. However, I've been encountering significant difficulties in getting the mask to display properl ...

Embeddable video player failing to adjust size properly within parent div

I've been tackling the challenge of making iframes responsive within a div element, but I've hit a roadblock. While there are plenty of solutions available online, none seem to work seamlessly when dealing with YouTube video embeds. Currently, m ...

The 'mat-table' component is triggering an error indicating that the 'dataSource' attribute is unrecognized in the table

Recently, I have been diving into the world of Material Library for Angular. Working with Angular version 15.0.1 and Material version 15.0.1, I decided to include a mat-table in my form (schedule.allocator.component.html): https://i.stack.imgur.com/c7bsO. ...

Parsing of CSS and Javascript is disabled within iframes

Within my node.js application, I have configured an endpoint where I can load some parsed HTML code. This is achieved through the following code: app.get('/code', function (req, res) { res.setHeader('Content-Type', 'text/html& ...

Creating a CSS animation to slide a div outside of its container is

I currently have a flexbox set up with two adjacent divs labeled as DIV 1 and DIV 2. By default, both DIV 1 and DIV 2 are visible. DIV 2 has a fixed width, occupying around 40% of the container's width. DIV 1 dynamically adjusts its width to ac ...

Adding clickable padding to a Draft.js editor can enhance the user experience and make the editing process

Is there a way to apply padding to the Draft.js Editor so that clicking on the padding area selects the Editor? If I add padding directly to the container div of the Editor, the padding displays properly but clicking on it does not enable writing in the E ...

Creating customized placeholders using CSS padding in HTML5

I came across this helpful post and attempted various methods to adjust the padding for my placeholder text, but unfortunately, it seems unwilling to cooperate. Below is the CSS code. (EDIT: This CSS was generated from SASS) #search { margin-top: 1px; ...

The Angular Syncfusion schedule is unable to call upon an object that may potentially be 'undefined'

Currently, I am developing an application using Angular Syncfusion to allow users to view and book appointments. I found a helpful resource at the following link: Below you can find the code snippet I have been working on: <ejs-schedule #scheduleObj ...

Blurring the background creates an "inset shadow" problem when transitioning

Problem: Strangely, when using Backdrop-filter: blur(Xpx); during a transition as shown below, unexpected "inset Shadows" mysteriously appear until the end of the transition. https://i.stack.imgur.com/uij7F.gif Illustration of the Issue Using jsfiddle Sp ...

Retrieve the value of the Observable when it is true, or else display a message

In one of my templates, I have the following code snippet: <app-name val="{{ (observable$ | async)?.field > 0 || "No field" }}" The goal here is to retrieve the value of the property "field" from the Observable only if it is grea ...