-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Organization): renaming and organization of theme files per disc…
…ussion closes #11
- Loading branch information
1 parent
3e05ef5
commit 08552a9
Showing
22 changed files
with
185 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.main-page { | ||
Button { | ||
font-size: 30; | ||
margin:10; | ||
} | ||
} | ||
.themes { | ||
Label { | ||
margin: 5; | ||
} | ||
Button { | ||
margin:5; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
@import 'scss/core'; | ||
/*! | ||
* NativeScript Theme v0.1.0 (https://nativescript.org) | ||
* Copyright 2016-2016 The Theme Authors | ||
* Copyright 2016-2016 Telerik | ||
* Licensed under MIT (https://github.com/NativeScript/theme/blob/master/LICENSE) | ||
*/ | ||
|
||
/** | ||
* Base style (un-themed) | ||
*/ | ||
@import 'scss/variables'; | ||
@import 'scss/index'; | ||
|
||
.main-page { | ||
// demo app | ||
@import 'demo'; | ||
|
||
Button { | ||
@include button-size(15, 15, 40, $btn-radius); | ||
} | ||
} |
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 @@ | ||
/*! | ||
* NativeScript Theme v0.1.0 (https://nativescript.org) | ||
* Copyright 2016-2016 The Theme Authors | ||
* Copyright 2016-2016 Telerik | ||
* Licensed under MIT (https://github.com/NativeScript/theme/blob/master/LICENSE) | ||
*/ | ||
|
||
@import 'scss/themes/core/dark'; | ||
@import 'scss/themes/core/platforms/index.android'; | ||
|
||
// demo app | ||
@import 'demo'; |
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 @@ | ||
/*! | ||
* NativeScript Theme v0.1.0 (https://nativescript.org) | ||
* Copyright 2016-2016 The Theme Authors | ||
* Copyright 2016-2016 Telerik | ||
* Licensed under MIT (https://github.com/NativeScript/theme/blob/master/LICENSE) | ||
*/ | ||
|
||
@import 'scss/themes/core/dark'; | ||
@import 'scss/themes/core/platforms/index.ios'; | ||
|
||
// demo app | ||
@import 'demo'; |
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 @@ | ||
/*! | ||
* NativeScript Theme v0.1.0 (https://nativescript.org) | ||
* Copyright 2016-2016 The Theme Authors | ||
* Copyright 2016-2016 Telerik | ||
* Licensed under MIT (https://github.com/NativeScript/theme/blob/master/LICENSE) | ||
*/ | ||
|
||
@import 'scss/themes/core/light'; | ||
@import 'scss/themes/core/platforms/index.android'; | ||
|
||
// demo app | ||
@import 'demo'; |
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 @@ | ||
/*! | ||
* NativeScript Theme v0.1.0 (https://nativescript.org) | ||
* Copyright 2016-2016 The Theme Authors | ||
* Copyright 2016-2016 Telerik | ||
* Licensed under MIT (https://github.com/NativeScript/theme/blob/master/LICENSE) | ||
*/ | ||
|
||
@import 'scss/themes/core/light'; | ||
@import 'scss/themes/core/platforms/index.ios'; | ||
|
||
// demo app | ||
@import 'demo'; |
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 |
---|---|---|
@@ -1,30 +1,43 @@ | ||
import {Observable} from 'data/observable'; | ||
import {topmost} from 'ui/frame'; | ||
import {knownFolders} from 'file-system'; | ||
import {isIOS, isAndroid} from 'platform'; | ||
var themes = require('nativescript-themes'); | ||
|
||
export class ThemesModel extends Observable { | ||
public btnText: string; | ||
public labelText: string; | ||
private _toggled: boolean = false; | ||
|
||
constructor() { | ||
super(); | ||
this.set('btnText', 'Nina'); | ||
this.set('labelText', 'Default'); | ||
} | ||
|
||
public switchTheme() { | ||
this._toggled = !this._toggled; | ||
public applyDefault() { | ||
this.set('labelText', 'Default'); | ||
themes.applyTheme(this.getPath('app')); | ||
} | ||
|
||
let appPath = knownFolders.currentApp().path + '/'; | ||
|
||
if (this._toggled) { | ||
this.set('btnText', 'Default'); | ||
themes.applyTheme(`${appPath}theme-nina.css`); | ||
|
||
} else { | ||
this.set('btnText', 'Nina'); | ||
themes.applyTheme(`${appPath}app.css`); | ||
} | ||
public applyLight() { | ||
this.set('labelText', 'Light'); | ||
themes.applyTheme(this.getPath('light')); | ||
} | ||
|
||
public applyDark() { | ||
this.set('labelText', 'Dark'); | ||
themes.applyTheme(this.getPath('dark')); | ||
} | ||
|
||
private getPath(name: string) { | ||
let appPath = knownFolders.currentApp().path + '/'; | ||
let platform = ''; | ||
// if (name !== 'app') { | ||
// if (isIOS) { | ||
// platform = '.ios'; | ||
// } else { | ||
// platform = '.android'; | ||
// } | ||
// } | ||
return `${appPath}${name}${platform}.css`; | ||
} | ||
} |
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
// Utilities | ||
@import 'mixins'; | ||
|
||
// Core CSS | ||
@import 'action-bar'; | ||
@import 'buttons'; | ||
@import 'labels'; | ||
@import 'list-view'; | ||
@import 'segmented-bar'; | ||
@import 'switch'; | ||
@import 'slider'; | ||
@import 'stack-layout'; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
// Just a sample | ||
// if we need custom styles for the theme, we can create them in files like this | ||
|
||
.btn { | ||
color: $btn-color; | ||
@include button-size(5, 10, 18, $btn-radius); | ||
} |
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,9 @@ | ||
// Core variables and mixins | ||
@import '../../variables'; | ||
@import 'variables_dark'; | ||
|
||
// Core CSS | ||
@import '../../index'; | ||
|
||
// Custom Theme Overrides | ||
@import 'buttons'; |
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,9 @@ | ||
// Core variables and mixins | ||
@import '../../variables'; | ||
@import 'variables_light'; | ||
|
||
// Core CSS | ||
@import '../../index'; | ||
|
||
// Custom Theme Overrides | ||
@import 'buttons'; |
4 changes: 4 additions & 0 deletions
4
app/scss/themes/_variables.scss → app/scss/themes/core/_variables_dark.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
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,28 @@ | ||
/** | ||
* TODO .... These are not correct ... just samples. | ||
*/ | ||
|
||
// Colors | ||
$primary: pink; | ||
$complimentary: purple; | ||
$gray: lightblue; | ||
$white: white; | ||
|
||
// Skin | ||
$background: $primary; | ||
$text-color: $gray; | ||
|
||
// Buttons | ||
$btn-color: $complimentary; | ||
$btn-font-size: 18; | ||
$btn-radius: 5; | ||
$btn-padding-x: 20; | ||
$btn-padding-y: 20; | ||
|
||
// Options | ||
// | ||
// Quickly modify global styling by enabling or disabling optional features. | ||
$enable-rounded: true !default; | ||
$enable-shadows: false !default; | ||
$enable-gradients: false !default; | ||
$enable-transitions: false !default; |
This file was deleted.
Oops, something went wrong.
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