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(ltr): add fallback styles for ltr + additional support. #413

Merged
merged 27 commits into from
Mar 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
495ef92
feat(): move rlt fab into components toolbar as a menu option
Mar 9, 2017
a0ac6cf
Merge branch 'develop' into feature/rtl-polish
Mar 9, 2017
b78da8f
fix(chips): added fallback for ltr support
Mar 9, 2017
33c23a4
fix(): leverage rtl mixin in chips
Mar 9, 2017
e79e457
fix(toolbar): set fallback for ltr
Mar 9, 2017
d4fed79
Merge branch 'develop' into feature/rtl-polish
emoralesb05 Mar 9, 2017
078f898
chore(): move ltr option to the whole components page
Mar 10, 2017
40ed7ac
feat(data-table): add fallback for ltr and fix selected rtl
Mar 10, 2017
444b1d4
Merge branch 'feature/rtl-polish' of https://github.com/Teradata/cova…
Mar 10, 2017
ed127df
feat(dialog): add fallback for ltr in dialogs
Mar 10, 2017
538dbfb
feat(expansion-panel): add fallback ltr
Mar 10, 2017
9e5e12a
feat(layouts): add ltr fallback and fix rtl
Mar 10, 2017
59ba67e
feat(menu): added fallback for ltr
Mar 10, 2017
755a9b4
feat(notifications): rollback since this was already working
Mar 10, 2017
194c10a
fix(): remove unused code
Mar 10, 2017
0e9abbe
fix(search): margin for rtl and fallback for ltr
Mar 10, 2017
73546bc
feat(search): change animation depending on rtl/ltr in search input
Mar 10, 2017
dbff94e
fix(search): fix rtl in search box
Mar 10, 2017
4da5845
fix(paging): remove unused style
Mar 10, 2017
3f3a83e
fix(stepper): icon in rtl
Mar 10, 2017
393d035
feat(file-upload): add rtl support
Mar 10, 2017
82e0615
rollback: we will fix this in a separate PR
Mar 10, 2017
1781ee9
rollback: we need to rethink how pad, pull and push for rtl
Mar 10, 2017
faa26a1
fix(): use default ltr
Mar 10, 2017
0d0397d
feat(): added some support for rtl in json-formatter
Mar 10, 2017
fb9d180
feat(paging): support paging rtl
Mar 10, 2017
1cf2197
feat(rtl): set dir in root `html` tag
Mar 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<td-layout #layout #root="$implicit" [dir]="direction">
<td-layout #layout>
<td-navigation-drawer sidenavTitle="Covalent" logo="assets:teradata">
<md-nav-list>
<a *ngFor="let item of routes" md-list-item (click)="layout.close()" [routerLink]="[item.route]"><md-icon>{{item.icon}}</md-icon>{{item.title}}</a>
</md-nav-list>
</td-navigation-drawer>
<a md-fab color="accent" class="mat-fab-postion-bottom fixed" style="z-index: 999; bottom: 15px; margin: 20px; padding: 10px;" (click)="root.dir = (root.dir == 'rtl' ? 'ltr' : 'rtl'); changeDir(root);" title="Toggle between RTL and LTR">
{{root.dir.toUpperCase()}}
</a>
<router-outlet></router-outlet>
</td-layout>
17 changes: 4 additions & 13 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, ElementRef, Inject, Renderer } from '@angular/core';
import { DomSanitizer, DOCUMENT } from '@angular/platform-browser';
import { MdIconRegistry, Dir } from '@angular/material';
import { Component } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { MdIconRegistry } from '@angular/material';

import { TranslateService } from '@ngx-translate/core';

Expand Down Expand Up @@ -36,13 +36,9 @@ export class DocsAppComponent {
},
];

direction: string = 'ltr';

constructor(private _iconRegistry: MdIconRegistry,
private _domSanitizer: DomSanitizer,
translateService: TranslateService,
private el: ElementRef, private renderer: Renderer,
@Inject(DOCUMENT) private document: any) {
translateService: TranslateService) {
// Set fallback language
translateService.setDefaultLang('en');
// Supported languages
Expand All @@ -67,9 +63,4 @@ export class DocsAppComponent {
this._iconRegistry.addSvgIconInNamespace('assets', 'querygrid',
this._domSanitizer.bypassSecurityTrustResourceUrl('app/assets/icons/querygrid.svg'));
}

changeDir(root: Dir): void {
this.direction = root._dir;
this.renderer.setElementAttribute(this.document.querySelector('html'), 'dir', this.direction);
}
}
14 changes: 13 additions & 1 deletion src/app/components/components/components.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<td-layout-nav-list #navList
#root="$implicit" dir="ltr"
logo="assets:teradata"
toolbarTitle="Covalent"
[opened]="media.registerQuery('gt-sm') | async"
Expand Down Expand Up @@ -48,6 +49,17 @@ <h3 md-line> {{item.title}} </h3>
<div td-toolbar-content layout="row" layout-align="center center" flex>
<span>Covalent Components &amp; Addons</span>
<span flex></span>
<button md-icon-button [mdMenuTriggerFor]="settingsMenu">
<md-icon>more_vert</md-icon>
</button>
<md-menu #settingsMenu="mdMenu">
<button md-menu-item (click)="root.dir = (root.dir == 'rtl' ? 'ltr' : 'rtl'); changeDir(root.dir)" title="Toggle between RTL and LTR">
<md-icon>swap_horiz</md-icon>
<span>{{root.dir.toUpperCase()}}</span>
</button>
</md-menu>
</div>
<div>
<router-outlet></router-outlet>
</div>
<router-outlet></router-outlet>
</td-layout-nav-list>
11 changes: 9 additions & 2 deletions src/app/components/components/components.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, HostBinding, AfterViewInit } from '@angular/core';
import { Component, HostBinding, AfterViewInit, ElementRef, Inject, Renderer } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';
import { TdMediaService } from '@covalent/core';

import { fadeAnimation } from '../../app.animations';
Expand Down Expand Up @@ -135,10 +136,16 @@ export class ComponentsComponent implements AfterViewInit {
title: 'NGX-Translate',
}];

constructor(public media: TdMediaService) {}
constructor(public media: TdMediaService,
private _renderer: Renderer,
@Inject(DOCUMENT) private _document: HTMLElement) {}

ngAfterViewInit(): void {
// broadcast to all listener observables when loading the page
this.media.broadcast();
}

changeDir(dir: string): void {
this._renderer.setElementAttribute(this._document.querySelector('html'), 'dir', dir);
}
}
17 changes: 5 additions & 12 deletions src/platform/core/chips/chips.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../common/styles/mixins';

:host {
display: block;
padding: 0px 5px 0px 5px;
Expand All @@ -6,25 +8,16 @@
cursor: default;
border-radius: 16px;
line-height: 32px;
[dir='ltr'] & {
margin: 8px 8px 0 0;
}
[dir='rtl'] & {
margin: 8px 0 0 8px;
}
@include rtl(margin, 8px 8px 0 0, 8px 0 0 8px);
padding: 0 12px;
box-sizing: border-box;
max-width: 100%;
position: relative;
md-icon {
position: relative;
top: 5px;
[dir='ltr'] & {
left: 5px;
}
[dir='rtl'] & {
right: 5px;
}
@include rtl(left, 5px, auto);
@include rtl(right, auto, 5px);
height: 18px;
width: 18px;
font-size: 19px;
Expand Down
21 changes: 15 additions & 6 deletions src/platform/core/common/styles/_structure.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ input {
pointer-events: none;
position: absolute;
overflow: hidden;
[dir='ltr'] & {left: 0;}
[dir='rtl'] & {right:0;}
left: 0;
[dir='rtl'] & {
right:0;
left: auto;
}
top: 0;
width: 100%;
height: 100%;
Expand All @@ -124,8 +127,11 @@ input {
pointer-events: none;
position: absolute;
overflow: hidden;
[dir='ltr'] & {left: 0;}
[dir='rtl'] & {right:0;}
left: 0;
[dir='rtl'] & {
right:0;
left: auto;
}
top: 0;
width: 100%;
height: 100%;
Expand Down Expand Up @@ -174,8 +180,11 @@ input {
display: block;
position: absolute;
background-color: #fafafa;
[dir='ltr'] & {right: 0;}
[dir='rtl'] & {left:0;}
right: 0;
[dir='rtl'] & {
left:0;
right: auto;
}
top: 0;
bottom: 0;
z-index: $z-index-scroll-mask;
Expand Down
20 changes: 14 additions & 6 deletions src/platform/core/common/styles/_toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ md-toolbar {
[md-button] {
&:first-of-type:not(:last-child) {

[dir='ltr'] & {margin-left: -6px;}
[dir='rtl'] & {margin-right: -6px;}
margin-left: -6px;
[dir='rtl'] & {
margin-right: -6px;
margin-left: 0;
}
}
&:last-of-type:not(:first-child) {
[dir='ltr'] & {margin-right: -6px;}
[dir='rtl'] & {margin-left: -6px;}
margin-right: -6px;
[dir='rtl'] & {
margin-left: -6px;
margin-right: 0;
}
}
}
.md-icon-logo {
margin-right: 10px;
[dir='ltr'] & {margin-right: 10px;}
[dir='rtl'] & {margin-left: 10px;}
[dir='rtl'] & {
margin-left: 10px;
margin-right: 0;
}
}
[md-icon-button] {
margin: 0 6px;
Expand Down
52 changes: 18 additions & 34 deletions src/platform/core/common/styles/utilities/_pad.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Pad (padding)
// --------------------------------------------------

body {
.pad {
padding: 20px;
}
Expand Down Expand Up @@ -53,46 +53,38 @@
}

.pad-right {
[dir='ltr'] & { padding-right: 20px;}
[dir='rtl'] & { padding-left: 20px;}
padding-right: 20px;
}




.pad-right-xxl {
[dir='ltr'] & { padding-right: 60px;}
[dir='rtl'] & { padding-left: 60px;}
padding-right: 60px;
}

.pad-right-xl {
[dir='ltr'] & { padding-right: 50px;}
[dir='rtl'] & { padding-left: 50px;}
padding-right: 50px;
}

.pad-right-lg {
[dir='ltr'] & { padding-right: 40px;}
[dir='rtl'] & { padding-left: 40px;}
padding-right: 40px;
}

.pad-right-md {
[dir='ltr'] & { padding-right: 30px;}
[dir='rtl'] & { padding-left: 30px;}
padding-right: 30px;
}

.pad-right-sm {
[dir='ltr'] & { padding-right: 10px;}
[dir='rtl'] & { padding-left: 10px;}
padding-right: 10px;
}

.pad-right-xs {
[dir='ltr'] & { padding-right: 5px;}
[dir='rtl'] & { padding-left: 5px;}
padding-right: 5px;
}

.pad-right-none {
[dir='ltr'] & { padding-right: 0px;}
[dir='rtl'] & { padding-left: 0px;}
padding-right: 0px;
}

.pad-bottom {
Expand Down Expand Up @@ -124,42 +116,34 @@
}

.pad-left {
[dir='ltr'] & { padding-left: 20px;}
[dir='rtl'] & { padding-right: 20px;}
padding-left: 20px;
}

.pad-left-xxl {
[dir='ltr'] & { padding-left: 60px;}
[dir='rtl'] & { padding-right: 60px;}
padding-left: 60px;
}

.pad-left-xl {
[dir='ltr'] & { padding-left: 50px;}
[dir='rtl'] & { padding-right: 50px;}
padding-left: 50px;
}

.pad-left-lg {
[dir='ltr'] & { padding-left: 40px;}
[dir='rtl'] & { padding-right: 40px;}
padding-left: 40px;
}

.pad-left-md {
[dir='ltr'] & { padding-left: 30px;}
[dir='rtl'] & { padding-right: 30px;}
padding-left: 30px;
}

.pad-left-sm {
[dir='ltr'] & { padding-left: 10px;}
[dir='rtl'] & { padding-right: 10px;}
padding-left: 10px;
}

.pad-left-xs {
[dir='ltr'] & { padding-left: 5px;}
[dir='rtl'] & { padding-right: 5px;}
padding-left: 5px;
}

.pad-left-none {
[dir='ltr'] & { padding-left: 0px;}
[dir='rtl'] & { padding-right: 0px;}
padding-left: 0px;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
padding: 0 28px 0 28px;

&:first-child {
[dir='ltr'] & { padding-left: 24px;}
[dir='rtl'] & { padding-right: 24px;}
@include rtl(padding-left, 24px, initial);
@include rtl(padding-right, initial, 24px);
}
&:last-child {
[dir='ltr'] & { padding-right: 24px;}
[dir='rtl'] & { padding-left: 24px;}
@include rtl(padding-left, initial, 24px);
@include rtl(padding-right, 24px, initial);
}

> * {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
position: relative;

&:first-child {
[dir='ltr'] & { padding-left: 24px;}
[dir='rtl'] & { padding-right: 24px;}
@include rtl(padding-left, 24px, initial);
@include rtl(padding-right, initial, 24px);
}
&:last-child {
[dir='ltr'] & { padding-right: 24px;}
[dir='rtl'] & { padding-left: 24px;}
@include rtl(padding-left, initial, 24px);
@include rtl(padding-right, 24px, initial);
}

md-icon {
Expand Down Expand Up @@ -62,14 +62,14 @@
&.mat-numeric {
@include rtl(text-align, right, left);
md-icon.td-data-table-sort-icon {
[dir='ltr'] & { margin-left: -22px;}
[dir='rtl'] & { margin-right: -22px;}
@include rtl(margin-left, -22px, initial);
@include rtl(margin-right, initial, -22px);
}
}
&:not(.mat-numeric) {
md-icon.td-data-table-sort-icon {
[dir='ltr'] & { margin-left: 6px;}
[dir='rtl'] & { margin-right: 6px;}
@include rtl(margin-left, 6px, initial);
@include rtl(margin-right, initial, 6px);
}
}
}
}
Loading