How to make title and date on one line in angular material - css

I have a title and date , but they are looking now like this:
title
date
but it has to be: title date.
<mat-card-header>
<mat-card-title >
<span [innerHTML]="item.title | highlight : searchQuery"></span>
<span class="spacer"></span>
<span>
<a mat-icon-button [routerLink]="['../', dossier.id , 'item', item.id]" i18n-title title="Edit">
<mat-icon>edit</mat-icon>
</a>
</span>
</mat-card-title>
<mat-card-subtitle >
<span *ngIf="!createdAtEqualsDate(item)">{{item.date | date: 'shortDate'}} <ng-template i18n>created</ng-template></span>
<span>{{item.createdAt | date: 'short'}}</span>
<span *ngIf="item.createdAt !== item.lastModifiedAt"><ng-template i18n>modified</ng-template> {{item.lastModifiedAt | date: 'short'}}</span>
</mat-card-subtitle>
</mat-card-header>
css:
mat-card-header{
justify-content: center;
}
So what I mean is that card-title and card-subtitle are on the same line and not under each other
I tried this example https://jsfiddle.net/VanessaRC/Lz9vz6bs/1/. But that doesnt fix it. Because I have a mat-card-header
oke, I have it now like this:
<mat-card-header>
<mat-card-title>
<span [innerHTML]="item.title | highlight: searchQuery"></span>
<span class="spacer"></span>
</mat-card-title>
<div class="title-date">
<span *ngIf="!createdAtEqualsDate(item)"
>{{ item.date | date: 'shortDate' }}<ng-template i18n>created</ng-template></span
>
<span>{{ item.createdAt | date: 'short' }}</span>
<span *ngIf="item.createdAt !== item.lastModifiedAt"
><ng-template i18n>modified</ng-template> {{ item.lastModifiedAt | date: 'short' }}</span
>
</div>
<span>
<a mat-icon-button [routerLink]="['../', dossier.id, 'item', item.id]" i18n-title title="Edit">
<mat-icon>edit</mat-icon>
</a>
</span>
</mat-card-header>
But then the date is on the left side next to the edit icon. But It has to be next to the title

You can add this to your styles, you will need to make a little more adjustments
.mat-card-header-text{
display: flex;
}

You could also use
.mat-card-header-text{
display: inline-block;
}
https://www.w3schools.com/css/css_inline-block.asp

Related

Why does font change for all of Bootstrap but not Angular header?

I want to change the font across my whole website (effectively changing the font globally), so I've overwritten the Bootstrap font by updating my styles.scss file as below:
$theme-colors:(
"primary": #84329b,
);
#import '../node_modules/bootstrap/scss/bootstrap';
html, body { height: 100%; }
body { margin: 0; font-family: 'MuseoModerno', cursive !important; }
This works successfully, however, the font in my header does not change in-line with this (see the below image).
How can I ensure the font changes for the header?
For completeness, I've included the html code for my header below. As you can see, I've attempted to update the font specifically on the header, as it wasn't working after updating the styles.scss file. Unfortunately, this doesn't seem to work either.
<link href="https://fonts.googleapis.com/css2?family=MuseoModerno:wght#200&display=swap" rel="stylesheet">
<mat-sidenav-container class="sidenav-container">
<!---links to appear in the sidenav if the device is a mobile-->
<mat-sidenav
#drawer
class="sidenav"
fixedInViewport
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
[mode]="(isHandset$ | async) ? 'over' : 'side'"
[opened]="false"
>
<mat-toolbar>Menu</mat-toolbar>
<mat-nav-list>
<a mat-list-item routerLink="/catalogue" (click)="drawer.close()"
>Catalogue</a
>
<a mat-list-item routerLink="/notepads" (click)="drawer.close()"
>Explore Pads</a
>
<hr class="divider-line">
<a mat-list-item routerLink="/login" (click)="drawer.close()">Login</a>
<a mat-list-item routerLink="/sign-up" (click)="drawer.close()"
>Sign Up</a
>
</mat-nav-list>
<hr class="divider-line">
</mat-sidenav>
<!---content below is for everything contained along the header, mobile or not-->
<mat-sidenav-content>
<mat-toolbar>
<!---this is the menu icon to appear on mobile-->
<button
mat-icon-button
(click)="drawer.toggle()"
*ngIf="isHandset$ | async"
>
<mat-icon>menu</mat-icon>
</button>
<!---spacer between the mobile menu button and Padder logo-->
<span class="left-spacer" *ngIf="isHandset$ | async"></span>
<!---Padder logo for desktop-->
<span *ngIf="!(isHandset$ | async)" class="logo" routerLink="/"
><img
class="logo-image"
src="../../../assets/imgs/padder-logo.png"
alt="Padder Logo"
/></span>
<!--links for the header when the device is not a handset-->
<div class="nav-links" *ngIf="!(isHandset$ | async)">
<a mat-button routerLink="/catalogue">Catalogue</a>
<a mat-button routerLink="/notepads">Explore Pads</a>
</div>
<div class="search-container" *ngIf="!(isHandset$ | async)">
<mat-form-field class="header-search">
<input matInput placeholder="Search for products or pads.." />
</mat-form-field>
</div>
<!---Padder logo for mobile-->
<span *ngIf="isHandset$ | async" class="logo" routerLink="/"
><img
class="logo-image-mobile"
src="../../../assets/imgs/padder-logo.png"
alt="Padder Logo"
/></span>
<!---spacer between Padder logo and login button-->
<span class="right-spacer" *ngIf="isHandset$ | async"></span>
<!--login / sign-up button to be shown when user not logged in, desktop-->
<div class="login-links">
<a mat-button routerLink="/login" *ngIf="!(isHandset$ | async)"
>Login</a
>
<a mat-button routerLink="/login" *ngIf="!(isHandset$ | async)"
>Sign Up</a
>
</div>
<!---search icon to be shown when the user is on mobile-->
<div>
<button mat-icon-button *ngIf="isHandset$ | async">
<mat-icon>search</mat-icon>
</button>
</div>
<!---dropdown to be down when the user is logged into the website-->
<!---
<div>
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<a mat-menu-item routerLink="/profile">
<span>Profile</span>
</a>
<a mat-menu-item href="">
<button mat-stroked-button>Logout</button>
</a>
</mat-menu>
</div>--->
</mat-toolbar>
<ng-content></ng-content>
</mat-sidenav-content>
</mat-sidenav-container>
In you styles.scss, do the following:
#import "https://fonts.googleapis.com/css2?family=MuseoModerno:wght#200&display=swap";
* {
font: 500 20px/32px Roboto, 'MuseoModerno', sans-serif !important
}
This will definitely work

Is there a way to make mat-menu-item same size as mat-button on click?

I would like to make it so that when I click the mat-button, the menu items would be the same size and push everything else down. Below are attached images of the current situation and desired.
Current closed dropdown
Current opened dropdown
Desired closed dropdown
Here is my HTML code:
<mat-footer>
<div class="footerLinks">
<span *ngFor="let footerLink of footerContent.footerLinks">
<span *ngIf="footerLink.footerDrop.length > 1 else single">
<a mat-button [matMenuTriggerFor]="subLinks" href="javascript:void(0)" title={{footerLink.subFooterTitle}}>{{footerLink.subFooterTitle}}
<mat-icon>arrow_drop_down</mat-icon>
</a>
<mat-menu #subLinks="matMenu" arrowPosition="up">
<a mat-menu-item *ngFor="let footerDrop of footerLink.footerDrop" href={{footerDrop.subLink}} target={{footerDrop.linktarget}} title={{footerDrop.footerSubTitle}}>{{footerDrop.footerSubTitle}}</a>
</mat-menu>
</span>
<ng-template #single >
<a mat-button *ngFor="let footerDrop of footerLink.footerDrop" href={{footerDrop.subLink}} target={{footerDrop.linktarget}} title={{footerDrop.footerSubTitle}}>{{footerDrop.footerSubTitle}}</a>
</ng-template>
</span>
</div>
<div class="social">
<span *ngFor="let socialLink of footerContent.socialLinks">
<a mat-flat-button class="{{socialLink.socialMediaService}}-icon" href={{socialLink.url}} title={{socialLink.socialMediaService}} target={{socialLink.linktarget}}></a>
</span>
</div>
<div class="terms">
<mat-copywrite-footer [innerHTML]="footerContent.finePrint.value"> </mat-copywrite-footer>
</div>
</mat-footer>

How to style a tooltip?

I have a tooltip that displays two sets of different info. I need to see some kind of break between the two because right now it all in one single line.
<ng-template #template let-anchor>
<span style="font-size: 17px;">
Last Sale Date : {{ lastSale.lastSaleDate }}
</span>
<span style="font-size: 17px;">
Next Sale Date: {{ nextFuture.nextFutureDate }}
</span>
</ng-template>
<div kendoTooltip
showOn="none"
[tooltipTemplate]="template"
filter=".k-grid td"
(mouseover)="showTooltip($event)">
I would like to see it in a nice format and 2 separte lines so it doesn't overlap.
You can try with this code
$(function(){
// Enables popover
$("[data-toggle=popover]").popover();
});
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.js"></script>
<div class="container">
<div class="row">
<a tabindex="0"
class="btn btn-lg btn-primary"
role="button"
data-html="true"
data-toggle="popover"
data-placement="bottom"
data-trigger="focus"
title="<b>Example popover</b> - title"
data-content="<div>Click <i class="fa fa-rss" aria-hidden="true"></i>
<hr>
</div>
</div>
</div>

Change Material 2 tab width without affecting tabs in parent component?

I have a child search component on every view that has tabs. Since these tabs only have icons in the tab label I have to style them to have a smaller width.
I found something that works:
/deep/ .mat-tab-label {
min-width: 80px !important;
}
However, this also affects the tabs in the parent component but without the /deep/ and !important the tabs don't change their width.
I've tried using all forms of ViewEncapsulation but none of them get the job done.
The tab structure is basically this:
<md-tab-group [selectedIndex]="selectedTabIndex">
<md-tab>
<ng-template md-tab-label><i class="fa fa-users"></i> {{'common_users' |
translate | capitalize}}
</ng-template>
<search-component></search-component>
</md-tab>
</md-tab-group>
The search component also has tabs in it:
<md-tab-group>
<md-tab>
<template md-tab-label>
<i class="fa fa-search" mdTooltip="{{'common_simplesearch' | translate | capitalize}}"></i>
</template>
<div fxLayout="column">
<form>
<md-input-container
*ngFor="let option of simpleSearchOptions; let i = index; let last = last" fxFlex="100%"
style="margin-right: 10px; margin-top: 5px;">
<input mdInput
type="text"
[(ngModel)]="option.value"
name="searchQuery{{i}}">
</md-input-container>
<div fxlayout="row">
<button md-raised-button mdTooltip="{{'common_search' | translate | capitalize}}" color="primary"
type="submit"
(keypress)="onEnter($event, searchSet)"
(click)="search(searchSet)">
{{'common_search' | translate | capitalize}}
</button>
<button *ngIf="canClear != false" md-raised-button mdTooltip="{{'common_clearSearch' | translate |
capitalize}}" (click)="clearSearch()"><i class="fa fa-eraser"></i>
</button>
</div>
</form>
</div>
</md-tab>
<md-tab>
<template md-tab-label>
<i class="fa fa-search-plus" mdTooltip="{{'common_advancedsearch' | translate | capitalize}}"></i>
</template>
<div fxlayout="column">
<form (ngSubmit)="search(searchSet)">
<div *ngFor="let searchItem of searchSet.searchItems; let i = index; let first = first; let last = last">
<md-select [ngModel]="searchItemType[i]"
(change)="onSearchTypeChange(searchItem, i)"
name="searchBy{{i}}" fxFlex="100">
<md-option [value]="stringify(option)" *ngFor="let option of searchOptions">{{option.display | translate |
capitalize}}
</md-option>
</md-select>
<div *ngIf="searchBy == 'identifier'">
<md-select [(ngModel)]="searchItem.key" name="idType" fxFlex="100">
<md-option *ngFor="let option of tokenSearchOptions" [value]="option">{{option | translate | capitalize}}
</md-option>
</md-select>
</div>
<md-select [(ngModel)]="searchItem.modifier" name="searchType{{i}}" fxFlex>
<md-option [value]="modifier.value" *ngFor="let modifier of searchModifiers[i]; let i = index">
{{modifier.display | translate |
capitalize}}
</md-option>
</md-select>
<md-input-container fxFlex="100">
<input mdInput
type="text"
placeholder="{{'common_search' | translate | capitalize}}"
[(ngModel)]="searchItem.value"
name="searchQuery{{i}}">
</md-input-container>
<a class="btn btn-alert btn-lg" (click)="addSearchItem()" [hidden]="!last">
<i class="ion-ios-plus-outline"></i>
</a>
<a class="btn btn-alert btn-lg" (click)="removeSearchItem(searchItem)" [hidden]="first || !last"><i
class="ion-ios-minus-outline"></i></a>
</div>
<button md-raised-button color="primary"
[disabled]="!searchSet.searchItems[0].key || !searchSet.searchItems[0].modifier || !searchSet.searchItems[0].value"
(keypress)="onEnter($event, searchSet)" (click)="search(searchSet)">{{'common_search' |
translate
| capitalize}}
</button>
<button md-raised-button (click)="clearSearch()">{{'common_clearSearch' | translate |
capitalize}}
</button>
</form>
</div>
</md-tab>
<md-tab>
<template md-tab-label>
<i class="fa fa-bookmark-o"></i>
</template>
Saved searches
</md-tab>
</md-tab-group>
How can I style the tabs only in the child component without affecting the parent?

Print md-dialog content with scroll bar

I have a long report made with md-list that is shown in a md-dialog, but when I try to print it, it only shows the section which i'm seeing on the screen no the entire length of the md-list. I have tryed this css tricks on #media:
#media print {
.grid-comissoes {
height: 100%;
width: 100%;
position: absolute;
overflow: hidden;
zoom: 0.8;
.grid-wrapper {
min-width: 0;
}
}
}
this is the part i'm trying to print:
<md-dialog-content class="md-dialog-content">
<div layout="row" layout-align="start center" layout-padding class="sd-mixed-row grey">
<span class="grey">Comissões a partir de</span>
<md-input-container flex="20" flex-xs="50" layout-no-padding>
<label>Início</label>
<input sd-datepicker="{changeMonth: false, changeYear: false}" ng-change="detalheCtrl.load()" aria-label="Início do período" ng-model="detalheCtrl.filter.startDh" ng-model-options="{debounce:300}">
</md-input-container>
<span class="grey">até</span>
<md-input-container flex="20" flex-xs="50" layout-no-padding>
<label>Fim</label>
<input sd-datepicker="{changeMonth: false, changeYear: false}" ng-change="detalheCtrl.load()" aria-label="Fim do período" ng-model="detalheCtrl.filter.endDh" ng-model-options="{debounce:300}">
</md-input-container>
</div>
<div layout="row" ng-if="detalheCtrl.loading" layout-align="center center">
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div>
<div layout="column" ng-if="!detalheCtrl.loading">
<md-list layout-fill-width class="grey md-body-1 grid-comissoes" ng-repeat="regra in detalheCtrl.regrasComissoes">
<md-list-item layout="row" class="regra-header">
{{ detalheCtrl.getInfoRegra(regra) }}
</md-list-item>
<div class="grid-wrapper" ng-if="regra.tipoPagamento === 1">
<md-list-item layout="row">
<span>Finalizado em</span>
<span flex="20">Paciente</span>
<span flex>Tratamento</span>
<span>Valor do tratamento</span>
<span>Comissão</span>
</md-list-item>
<md-divider></md-divider>
<div ng-repeat="recebimentoTratamento in regra.recebimentosTratamentos">
<md-list-item layout="row">
<span>{{ recebimentoTratamento.tratamento.dataFinal | dateFormat }}</span>
<span flex="20">{{ recebimentoTratamento.tratamento.paciente.nome }}</span>
<span flex>{{ recebimentoTratamento.tratamento.procedimento.nome }} {{ recebimentoTratamento.tratamento.denteDTO.nome }}</span>
<span>
{{ recebimentoTratamento.tratamento.valor | currency }}
</span>
<span>{{ recebimentoTratamento.valorCalculadoComissao | currency }}</span>
</md-list-item>
<md-divider></md-divider>
</div>
<md-list-item layout="row" class="footer-grid">
<span></span>
<span flex="20"></span>
<span flex></span>
<span></span>
<span>Total</span>
<span>{{ regra.total | currency }}</span>
</md-list-item>
</div>
<div class="grid-wrapper" ng-if="regra.tipoPagamento === 2">
<md-list-item layout="row">
<span>Pago em</span>
<span flex="20">Paciente</span>
<span flex>Tratamento</span>
<span flex="20">Valor Pago</span>
<span>Parcela</span>
<span>Comissão</span>
</md-list-item>
<md-divider></md-divider>
<div ng-repeat="recebimentoTratamento in regra.recebimentosTratamentos">
<md-list-item layout="row">
<span>{{ recebimentoTratamento.recebimento.dataPagamento | dateFormat }}</span>
<span flex="20">{{ recebimentoTratamento.tratamento.paciente.nome }}</span>
<span flex>{{ recebimentoTratamento.tratamento.procedimento.nome }} {{ recebimentoTratamento.tratamento.denteDTO.nome }}</span>
<div layout="row" flex="20">
<span ng-if="!detalheCtrl.showInfo(recebimentoTratamento)" flex>{{ recebimentoTratamento.valor | currency }}</span>
<span ng-if="detalheCtrl.showInfo(recebimentoTratamento)" flex>
{{ recebimentoTratamento.valor | currency }} de {{ recebimentoTratamento.recebimento.valor | currency }}
<md-icon style="fill: #2193D7 !important;" class="info-popover-comissao" md-svg-icon="info-full" ng-if="detalheCtrl.showInfo(recebimentoTratamento)">
<sd-popover class="popover-comissoes" event="hover" align="bottom center">
<div layout="column" class="md-body-1 grey">
<span>O paciente pagou a parcela {{ recebimentoTratamento.recebimento.parcela }}/{{recebimentoTratamento.recebimento.numeroDeParcelas}} de {{ recebimentoTratamento.recebimento.valor | currency }} para a clínica.</span>
<span layout-margin-top>A comissão da {{ detalheCtrl.profissional.nome }} será gerada apenas sobre o valor de {{ recebimentoTratamento.valor | currency }} correspondente ao tratamento {{ recebimentoTratamento.tratamento.procedimento.nome }}.</span>
<span layout-margin-top>O restante do recebimento é referente a tratamentos realizados por outros profissionais.</span>
</div>
</sd-popover>
</md-icon>
</span>
</div>
<span>{{ recebimentoTratamento.recebimento.parcela }}/{{recebimentoTratamento.recebimento.numeroDeParcelas}}</span>
<span>{{ recebimentoTratamento.valorCalculadoComissao | currency }}</span>
</md-list-item>
<md-divider></md-divider>
</div>
<md-list-item layout="row" class="footer-grid">
<span></span>
<span flex="20"></span>
<span flex></span>
<span></span>
<span>Total</span>
<span>{{ regra.total | currency }}</span>
</md-list-item>
</div>
</md-list>
<div layout="column" layout-align="center end" layout-margin-top>
<span layout-margin-top>Total a pagar {{ detalheCtrl.total | currency }}</span>
</div>
</div>
</md-dialog-content>
I think it's already reported in the angular repo
however you can get a simple workaround by setting up manually a descent height for your modal:
config: MdDialogConfig = {
disableClose: true,
width: '',
height: '600px',
position: {
top: '',
bottom: '',
left: '',
right: ''
}
};

Resources