-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
905 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
All Nebular components support RTL out of the box. | ||
|
||
The components that accept a position as a setting now also support logical start and end values, similar to flexbox. Value of start and end depends on current layout direction. For LTR it's left and for RTL - right. | ||
For instance, if we need the sidebar to be positioned logically depending on a language direction, then instead of setting it to left we can set its position to start: | ||
|
||
```html | ||
<nb-sidebar start></nb-sidebar> | ||
``` | ||
|
||
Document direction could be set through the `NbThemeModule.forRoot` call. Supported values are `ltr` and `rtl`. | ||
|
||
```typescript | ||
@NgModule({ | ||
imports: [ | ||
NbThemeModule.forRoot(nbThemeOptions, nbJSThemes, nbMediaBreakpoints, 'rtl') | ||
] | ||
}) | ||
``` | ||
Default value is `ltr`. | ||
|
||
<div class="note note-info"> | ||
<div class="note-title">Note</div> | ||
<div class="note-body"> | ||
Components must be placed inside of the `<nb-layout></nb-layout>` component to correctly support language direction. | ||
</div> | ||
</div> | ||
|
||
To help you add RTL support to your custom components, Nebular provides you with two scss mixins: `nb-lrt` and `nb-rtl`. You can use them to alter values of css properties, which don't support logical values, like paddings, margins, etc. You can pass single property and value as arguments, pass multiple statements as a content of mixin or both. For example: | ||
```scss | ||
:host { | ||
nb-ltr(padding-left, 1em); | ||
nb-rtl(padding-right, 1em); | ||
} | ||
``` | ||
```scss | ||
:host { | ||
nb-ltr() { | ||
padding-left: 1em; | ||
}; | ||
nb-rtl() { | ||
padding-right: 1em; | ||
}; | ||
} | ||
``` | ||
|
||
Please note, the mixins are only available within component `:host` selector or `nb-install-component()` mixin if used. | ||
|
||
If you need to change direction dynamically, get current value or listen to changes of direction, Nebular provides `NbLayoutDirectionService`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/app/layout-direction-toggle/layout-direction-toggle.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
:host { | ||
display: block; | ||
padding: 0.5em; | ||
|
||
label { | ||
margin: 0; | ||
} | ||
|
||
span { | ||
vertical-align: middle; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/app/layout-direction-toggle/layout-direction-toggle.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component } from '@angular/core'; | ||
import { NbLayoutDirectionService, NbLayoutDirection } from '@nebular/theme'; | ||
|
||
@Component({ | ||
selector: 'nb-layout-direction-toggle', | ||
styleUrls: [ './layout-direction-toggle.component.scss' ], | ||
template: ` | ||
<label dir="ltr"> | ||
<input type="checkbox" value="isRtl" (click)="toggleFlow()" /> | ||
<span>RTL</span> | ||
</label> | ||
`, | ||
}) | ||
export class NbLayoutDirectionToggleComponent { | ||
constructor(private directionService: NbLayoutDirectionService) {} | ||
|
||
get isRtl() { | ||
return this.directionService.isRtl(); | ||
} | ||
|
||
toggleFlow() { | ||
const oppositeDirection = this.isRtl | ||
? NbLayoutDirection.LTR | ||
: NbLayoutDirection.RTL; | ||
this.directionService.setDirection(oppositeDirection); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,10 +39,6 @@ | |
} | ||
} | ||
|
||
.front-container { | ||
margin-right: -100%; | ||
} | ||
|
||
.back-container { | ||
transform: rotateY(180deg); | ||
} | ||
|
Oops, something went wrong.