How to enable pagination on vertically aligned Angular Material tabs (mat-tabs)? - css

I arranged my angular material tabs vertically using CSS. Unfortunately, the pagination to navigate to the invisible tabs is not displayed
My container has a fixed height (max-height: 177px) so that only a certain number of tabs are visible. The pagination should appear when this fixed height is exceeded.
Here is my CSS / SCSS for the vertical tabs:
:host ::ng-deep {
.mat-tab-group {
flex-direction: row-reverse;
.mat-tab-nav-bar,
.mat-tab-header {
border: 0;
}
.mat-tab-header {
display: flex;
align-items: flex-end;
max-height: 177px;
right: 50px;
bottom: 50px;
z-index: 2147483647;
.mat-tab-labels {
flex-direction: column;
background: gray;
.mat-tab-label {
margin: 0;
padding: 20px;
cursor: pointer;
&:not(:last-child) {
border-bottom: 1px solid white;
}
&.mat-tab-label-active {
background-color: white !important;
width: 100%;
}
}
}
}
.mat-tab-body-wrapper {
width: 100%;
height: 100%;
display: table;
}
}
}
My template is structured like this:
<content>
<div class="main-wrapper i-wrapper">
<div class="header">
<div class="title">
<h4>Title</h4>
</div>
</div>
<mat-tab-group mat-align-tabs="end">
<div *ngFor="let item of items; let i = index">
<mat-tab label="{{i}}">
<div class="device-map-container">
<div class="device-map">
<img id="img_equipment" [src]="apiUrl + '/path/to/svg/' + asset | sanitize">
<a *ngFor="let data of SVGdata"
title="{{ data.title }}"
class="device-link">
</a>
<div class="wrapper">
<!-- another angular component -->
</div>
</div>
</div>
</mat-tab>
</div>
</mat-tab-group>
</div>
</content>
In dev tools the templates looks like this:
<mat-tab-group _ngcontent-nnd-c412="" mat-align-tabs="end" animationduration="0ms" class="mat-tab-group mat-primary" ng-reflect-animation-duration="0ms">
<mat-tab-header class="mat-tab-header" ng-reflect-selected-index="0" ng-reflect-disable-ripple="false" ng-reflect-disable-pagination="false">
<div aria-hidden="true" mat-ripple="" class="mat-ripple mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4 mat-tab-header-pagination-disabled" ng-reflect-disabled="true">
<div class="mat-tab-header-pagination-chevron"></div>
</div>
<div class="mat-tab-label-container">
<div role="tablist" class="mat-tab-list" style="transform: translateX(0px);">
<div class="mat-tab-labels">
<div role="tab" mattablabelwrapper="" mat-ripple="" cdkmonitorelementfocus="" class="mat-ripple mat-tab-label mat-focus-indicator mat-tab-label-active ng-star-inserted" id="mat-tab-label-0-0" ng-reflect-disabled="false" tabindex="0" aria-posinset="1" aria-setsize="2" aria-controls="mat-tab-content-0-0" aria-selected="true" aria-disabled="false">
<div class="mat-tab-label-content">
</div>
</div>
<div role="tab" mattablabelwrapper="" mat-ripple="" cdkmonitorelementfocus="" class="mat-ripple mat-tab-label mat-focus-indicator ng-star-inserted" id="mat-tab-label-0-1" ng-reflect-disabled="false" tabindex="-1" aria-posinset="2" aria-setsize="2" aria-controls="mat-tab-content-0-1" aria-selected="false" aria-disabled="false">
<div class="mat-tab-label-content">
</div>
</div>
</div>
<mat-ink-bar class="mat-ink-bar" style="visibility: visible; left: 0px; width: 50px;"></mat-ink-bar>
</div>
</div>
<div aria-hidden="true" mat-ripple="" class="mat-ripple mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4 mat-tab-header-pagination-disabled" ng-reflect-disabled="true">
<div class="mat-tab-header-pagination-chevron"></div>
</div>
</mat-tab-header>
<div class="mat-tab-body-wrapper">
<mat-tab-body role="tabpanel" class="mat-tab-body ng-tns-c380-10 mat-tab-body-active ng-star-inserted" id="mat-tab-content-0-0" ng-reflect-_content="[object Object]" ng-reflect-position="0" ng-reflect-origin="1" ng-reflect-animation-duration="0ms" aria-labelledby="mat-tab-label-0-0">
<div class="mat-tab-body-content ng-tns-c380-10 ng-trigger ng-trigger-translateTab" style="transform: none;">
<div _ngcontent-nnd-c412="" class="device-map-container ng-star-inserted" style="">
<div _ngcontent-nnd-c412="" class="device-map">
<img _ngcontent-nnd-c412="" id="img_equipment" alt="" src="data:image/svg+xml;base64,...">
</div>
</div>
</div>
</mat-tab-body>
<mat-tab-body role="tabpanel" class="mat-tab-body ng-tns-c380-11 ng-star-inserted" id="mat-tab-content-0-1" ng-reflect-_content="[object Object]" ng-reflect-position="1" ng-reflect-animation-duration="0ms" aria-labelledby="mat-tab-label-0-1">
<div class="mat-tab-body-content ng-tns-c380-11 ng-trigger ng-trigger-translateTab" style="transform: translate3d(100%, 0px, 0px); min-height: 1px;">
<!--container-->
</div>
</mat-tab-body>
</div>
</mat-tab-group>
Currently it looks like this (6 elements are visible. But there are more than 6 tabs in the container):

Related

How to make the header take up the full width in a media query?

I wrote the media queries for smaller screens ,but i can not seem to make them work for ipads. I have a problem with the width of the header and the navbar. They don't seem to take up the full width even though I wrote margin and padding 0 (as an asterisk). The max-width of the html is 1600px. Here is a Print screen.
<header>
<div class="Header-TopContainer">
<div class="Header-MyAccountItem">
<i class="fas fa-user account "></i>
</div>
<div class="Header-MyAccount">
My Account
</div>
<div class="Header-CartItem">
<i class="fas fa-cart-plus cart"></i>
</div>
<div class="Header-Cart">
Cart
</div>
<div class="Header_CheckoutItem">
<i class="fas fa-check-circle check"></i>
</div>
<div class="Header-Checkout">
Checkout
</div>
<div class="Header-VerticalLine"><img src="./Images/first%20hr.png" alt="vertical line"></div>
<div class="Header-Search"><i class="fas fa-search" id="search"></i></div>
</div>
<div class="line mqtablet">
<img src="./Images/long.png" alt="vertical line">
</div>
<div class="Header-LogoContainer mqtablet">
<div class="Header-LogoText">
<h1>Car<span style="color:#ff3448">Store</span></h1>
<p class="Header-LogoSubText">Best Car Seller</p>
</div>
<div class="Header-Phone">
<div class="Header-PhoneIcon">
<i class="fas fa-mobile-alt mobile"></i>
<h2>+123 456 7890</h2>
</div>
<div class="Header-PhoneNumber">
<p class="Header-WorkingHours">mon-fri:8:30am-7:30pm; sat-sun:9:30am-4:30pm</p>
</div>
</div>
<div class="Header-container">
<div class="Header-Wishlist">
<div class="Header-WishlistVLine vline">
<img src="./Images/first%20hr.png" alt="vertical line">
</div>
<div class="Wishlist">
<div class="Header-WishlistIcon">
<i class="fas fa-star wishlisticon"></i>
</div>
<div class="Header-WishlistText">
Wishlist
</div>
</div>
</div>
<div class="Header-Compare">
<div class="Header-WishlistVLine">
<img src="./Images/first%20hr.png" alt="vertical line">
</div>
<div class="Compare">
<div class="Header-CompareIcon">
<i class="fas fa-car compareicon"></i>
</div>
<div class="Header-CompareText">
Compare
</div>
</div>
</div>
<div class="Header-MyCart">
<div class="Header-WishlistVLine">
<img src="./Images/first%20hr.png" alt="vertical line">
</div>
<div class="Mycart">
<div class="Header-MyCartIcon">
<i class="fas fa-cart-plus cart mycarticon"></i>
</div>
<div class="Header-MyCartText'">
My cart
</div>
</div>
</div>
</div>
</div>
</header>
<nav class="toggle-menu">
<label for="toggle">☰</label>
<input type="checkbox" id="toggle"/>
<ul class="MainMenu">
<li>Home</li>
<li>Services</li>
<li>About</li>
<li>Reviews</li>
<li>Locations</li>
<li>Contacts</li>
</ul>
</nav>
#media(min-width:768px) and (max-width:1024px) {
header {
position: relative;
height: 17rem;
text-align: center;
}
.Header-TopContainer,
.Header-Phone {
display: none;
}
.mqtablet {
display: flex;
flex-direction: column;
text-align: center;
}
.Header-LogoText {
margin: 0.5rem;
}
.line {
position: absolute;
top: 9rem;
}
.Header-container {
margin-left: 10%;
}
.vline {
display: none;
}
nav {
text-align: center;
}
ul {
flex-wrap: nowrap;
justify-content: flex-end;
padding-right: 9rem;
}
ul li a {
padding-left: 5rem;
}

Scroll for background is not working

I am implementing a chat module like linked-in or facebook. User List is one parent component (col-md-12) and after each user click, I am creating a new child component (col-md-3 each). Everything is working fine but the scroll option on (col-md-12) is not working. The position of parent and child component is fixed hence the background scroll is only working if I scroll outside col-md-12 class area.
<div class="row" >
<div class="content">
<div class="row">
<div class="col-md-12" id="ng-chat-view">
<div class="col-md-3 chat-farmer-list-ui">
<div id="ng-chat-people" [ngClass]="{'ng-chat-people-collapsed':isCollapsed}">
<a href="javascript:void(0);" class="ng-chat-title shadowed" matTooltip={{farmerListTooltip}} (click)="onChatTitleClicked($event)">
<span>
Farmer List
</span>
</a>
<input *ngIf="!isCollapsed" id="ng-chat-search_friend" type="search" placeholder="Search" [(ngModel)]="search" (ngModelChange)="getFarmerBySearchVal(search)"
/>
<ul id="ng-chat-users" *ngIf="!isCollapsed">
<li *ngFor="let user of farmers">
<div *ngIf="!user.imageUrl" class="icon-wrapper">
<i class="user-icon"></i>
</div>
<img *ngIf="user.imageUrl" alt="" class="avatar" height="30" width="30" src="{{user.imageUrl}}"/>
<strong title="{{user.user}}" (click)="openChatWindow(user, true)">{{user.name}}</strong>
</li>
</ul>
</div>
</div>
<div class="col-md-9 m-l">
<div *ngFor="let user of userInfo; let i = index">
<div>
<app-chatwindow [userInfo]="user" (onWindowCloseNotify)="onWindowCloseInChildComponent($event)"></app-chatwindow>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
#ng-chat-view{
position: fixed;
bottom: 0%;
margin-right: 10px;
font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
font-size: 15px;
z-index:999;
cursor: pointer;
}
.row .m-l{
margin-left: -92px;
float: left;
}
#media (min-width: 992px){
.chat-farmer-list-ui {
float: right;
}
}

Vertical scroll not working inside ul tag overlay in Angular app

I am trying to scroll through a list of items, but scroll is working only for some of the items, not all. After a certain item, the scroll stops and does not go the last item.
Here is the Stackblitz link.
https://angular-cym8q4.stackblitz.io/
This is for a chatlist overlay which contains list of profiles. Please refer to the following screenshot:
In the above screenshot, I am not able to scroll through all the profiles. Scroll if happening for only some of the profiles, it is not going to the very end of the list.
Here is my code:
app.component.html
<div class="container-fluid">
<div class="row">
<div class="col-3 d-none d-lg-block col-offset-5 red coloverlay bg-custom">
<app-chatlist></app-chatlist>
</div>
</div>
</div>
app.component.css
.coloverlay {
background-color: rgba(233, 33, 33, 0.4);
margin: 0;
padding: 0;
position: fixed;
top: 150px;
z-index: 1;
bottom: 0;
right: 0;
margin: 0;
}
.bg-custom {
background: #2c3e50;
}
chatlist.component.html
<div class="container-fluid p-0">
<div class="row m-0 ">
<div class="col p-0">
<div class="d-flex flex-row chatlistbox ">
<div class="m-2">
Chat
</div>
<div class="ml-auto mt-1 pr-2">
<i class="fa fa-window-minimize " aria-hidden="true"></i>
</div>
<div class="m-2">
<i class="fa fa-cog" aria-hidden="true"></i>
</div>
</div>
<div class="customList">
<ul class="list-group overflow-auto" id="contact-list">
<app-chatlist-item class="list-group-item p-0 border-0" *ngFor="let el of elList" [element]="el">
</app-chatlist-item>
</ul>
</div>
</div>
</div>
</div>
chatlist.component.css
.overflow-auto {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
}
.customList {
height: 93%;
}
.chatlistbox {
background: aquamarine;
height: 2%;
}
chatlist-item.component.html
<div class="d-flex flex-row bg-custom item">
<div class="p-2">
<img src="{{element.imagePath}}" alt="" />
</div>
<div class="p-2">
<div class="d-flex flex-column flex-wrap name">
<h6 class="m-0">
{{element.firstName}} {{element.lastName}}
</h6>
<span class="details">
{{element.details}}
</span>
</div>
</div>
</div>
chatlist-item.component.css
img {
width: 80px;
height: 80px;
border-radius: 40px;
padding: 3px;
float: left;
cursor: pointer;
}
.bg-custom {
background: #2c3e50;
}
* {
color: #e3dcdc;
}
.item:hover {
background: #32465a;
}
I am not sure what is the problem. Any help would be highly apprecitated.
The issue is that the container is taller than the page, so the scroll bar goes off the page.
To fix it, you need to set the height on some of the elements, like so:
.container-fluid.p-0,
.row.m-0,
.col.p-0 {
height: 100%;
}
Finally, you will need to change the height of customList. I would recommend using calc instead of a fixed percentage, which may not be what you want.
.customList {
height: calc(100% - 15px);
}
Here is a fork of the stackblitz with the CSS fixed:
https://stackblitz.com/edit/angular-7c7dmk?file=src/app/chatlist/chatlist.component.css

Semantic UI Sidebar height is larger than viewport size

Example JSFiddle: https://jsfiddle.net/eqf8wwxe/
I'm trying to use the Semantic UI sidebar with a footer. However, the height of the page is not greater than the view-port by the height of the footer.
How can I go about correcting this? What is causing this in this situation?
$('.ui.sidebar').sidebar({
context: $('#main-sidebar-segment')
})
* {
border-radius: 0!important;
}
body {
background: #f1f1f1;
//background: #8b8b8b;
//display: flex;
//flex-flow: column;
height: 100%;
}
#main-sidebar-segment {
//display: flex;
//flex-flow: column;
}
.ui.main.container {
//flex: 1 1 auto;
}
.ui.inverted.footer.segment {
//flex: 0 1 40px;
margin: 0;
z-index: 1000;
}
.ui.grid {
//margin: 1rem;
}
.ui.inverted.green.dashboard.segment {
background-color: #2fb34e!important;
color: #FFF!important;
}
.ui.inverted.orange.dashboard.segment {
background-color: #f26b1c!important;
}
.ui.stat.header.segment {
padding: 0.5em;
}
.ui.inverted.dark.blue.segment {
border: 2px solid #2185D0;
background-color: #4c4f52!important;
}
.ui.ordered.large.list .list>.item:before,
.ui.ordered.large.list > .item::before {
font-size: 1.3em;
content: counters(ordered, " ") ". ";
}
.ui.ordered.large.list .content {
margin-left: 0.3em;
}
.ui.secondary.blue.filled.segment {
background: linear-gradient(rgba(255, 255, 255, .2) 0, rgba(255, 255, 255, .2) 100%) #4c4f52;
background-color: #2185D0!important;
}
.black.header {
color: black;
}
h3.compact.header {
margin: 0 !important;
}
.ui.inverted.sidebar {
background: #37393a;
//margin-top: 40px !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/semantic.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/semantic.min.js"></script>
<body >
<div id="main-sidebar-segment" style="margin-bottom: 0; border: none;" class="ui bottom attached segment pushable">
<div class="ui left visible inline vertical inverted thin sidebar labeled menu">
<a class="item">
<i class="home icon"></i> Home
</a>
<a class="item">
<i class="bar chart icon"></i>Reports
</a>
<a class="item">
<i class="ordered list icon"></i>Leaderboards
</a>
<a class="item">
<i class="configure icon"></i>Tools
</a>
</div>
<div class="ui inverted fluid fixed menu">
<div class="ui container">
<a class="active item"><i class="home icon"></i>Home</a>
<div class="compact right menu">
<div class="ui dropdown item">
<div class="default text">Select World</div>
<input type="hidden" value="">
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" data-value="1">World 1</div>
<div class="item" data-value="2">World 2</div>
<div class="item" data-value="3">World 3</div>
</div>
</div>
<a class="icon item"><i class="options icon"></i></a>
<a class="item"><i class="orange sign out icon"></i>Logout</a>
</div>
</div>
</div>
<div class="pusher">
</div>
<div class="ui inverted footer segment">
<div class="ui center aligned container">
<div class="ui horizontal inverted small divided link list">
<a class="item" href="#">Report An Issue</a>
<a class="item" href="#">Chat</a>
<a class="item" href="#">Contact</a>
</div>
<div>
Created and maintained by
<a class="teal link" href="#">
<h5 style="display:inline;" class="ui teal header">
Douglas Gaskell
</h5>
</a>
</div>
</div>
</div>
</div>
</body>
The .pusher has a min-height: 100% which is the culprit pushing your footer out of the viewport.
I would just override that style (or if you are using the .pusher class elsewhere make a new css class for it.)
#main-sidebar-segment .pusher {
min-height: calc(100vh - 80px);
}
I do 80px because that is the height of your footer.
https://jsfiddle.net/8yobm8u3/

Flex-box justify-content not working whilst align-items does

I'm trying to move around text with justify-content with flex box and whilst align-items works to move the content vertically, justify-content doesn't work to move the content horizontally.
I know I can use text-align, however I don't like how it moves all the text to the far right including the sub-title text, which I want to start at the same place as the title does - I believe this would be what justify-content would do.
CodePen: http://codepen.io/gutterboy/pen/yYxmLP
HTML:
<div id="main-slider" class="carousel">
<div class="container">
<div class="row">
<div class="col-sm-offset-1 col-sm-10">
<div class="carousel-inner" role="listbox">
<div class="item item1 active">
<img src="http://dreamatico.com/data_images/car/car-1.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
<div class="item item2">
<img src="http://dreamatico.com/data_images/car/car-8.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ol class="carousel-indicators">
<li data-target="#main-slider" data-slide-to="0" class="active"></li>
<li data-target="#main-slider" data-slide-to="1"></li>
</ol>
CSS:
.item {
position: relative;
.details {
position: absolute;
top: 0;
text-align: center;
width: 100%;
height: 100%;
padding: 25px;
color: #fff;
z-index: 2;
align-items: flex-end;
justify-content: center;
h2 {
margin-top: 0;
}
}
&.item2 {
.details {
align-items: flex-start;
justify-content: flex-start;
}
}
}
.fix-flex {
width: 100%;
}
.flex-row {
display: flex;
flex-flow: row nowrap;
}
There is more CSS related to the code, but it's related to bootstrap.
The issue you are having is due to your fix-flex class. It has a width of 100%. It is being centered with justify-content:center but since the element is the same size of its container it is not visually obvious that it is working. Check out my fork of your codepen.
Fork of your codepen
This should be removed
.fix-flex {width:100%;}
After reading #paulie_D's comments I realised it had to do with the fix-flex class which had a style of width: 100%; set and was wrapped around the content I was trying to justify and hence it really couldn't move it.
This was also pointed out by Adrian Eufracio's answer; however removing the div altogether would cause the issue I was trying to prevent; so I had to leave the div in the code but just remove the width: 100%; from the styles and I can now justify the content and the text doesn't wrap.
CodePen: http://codepen.io/gutterboy/pen/jbeOrP
HTML:
<div id="main-slider" class="carousel">
<div class="container">
<div class="row">
<div class="col-sm-offset-1 col-sm-10">
<div class="carousel-inner" role="listbox">
<div class="item item1 active">
<img src="http://dreamatico.com/data_images/car/car-1.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
<div class="item item2">
<img src="http://dreamatico.com/data_images/car/car-8.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ol class="carousel-indicators">
<li data-target="#main-slider" data-slide-to="0" class="active"></li>
<li data-target="#main-slider" data-slide-to="1"></li>
</ol>
CSS:
.item {
position: relative;
.details {
position: absolute;
top: 0;
text-align: center;
width: 100%;
height: 100%;
padding: 25px;
color: #fff;
z-index: 2;
align-items: flex-end;
justify-content: center;
h2 {
margin-top: 0;
}
}
&.item2 {
.details {
align-items: flex-start;
justify-content: flex-start;
}
}
}
.flex-row {
display: flex;
flex-flow: row nowrap;
}

Resources