Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
c1ccb022
Commit
c1ccb022
authored
Jan 01, 2018
by
Rob Stupay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
successful 1st part of implementing the theme switch
parent
4ff076a6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
18 deletions
+62
-18
terminal.js
src/app/panels/terminal.js
+2
-2
settings-tab.js
src/app/tabs/settings-tab.js
+38
-3
theme-chooser.js
src/app/theme/theme-chooser.js
+22
-13
No files found.
src/app/panels/terminal.js
View file @
c1ccb022
...
@@ -17,10 +17,10 @@ var csjs = require('csjs-inject')
...
@@ -17,10 +17,10 @@ var csjs = require('csjs-inject')
// var styles = styleGuide()
// var styles = styleGuide()
var
styleGuide
=
require
(
'../theme/theme-chooser'
)
var
styleGuide
=
require
(
'../theme/theme-chooser'
)
console
.
log
(
styleGuide
)
//
console.log(styleGuide)
// var styleGuide = remixLib.ui.styleGuide
// var styleGuide = remixLib.ui.styleGuide
// var styles = styleGuide('fred')
// var styles = styleGuide('fred')
var
styles
=
styleGuide
()
var
styles
=
styleGuide
.
chooser
()
var
css
=
csjs
`
var
css
=
csjs
`
.panel {
.panel {
...
...
src/app/tabs/settings-tab.js
View file @
c1ccb022
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
var
$
=
require
(
'jquery'
)
var
$
=
require
(
'jquery'
)
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
QueryParams
=
require
(
'../../lib/query-params'
)
var
QueryParams
=
require
(
'../../lib/query-params'
)
var
Storage
=
require
(
'../../storage'
)
var
styleGuide
=
require
(
'../theme/theme-chooser'
)
// -------------- styling ----------------------
// -------------- styling ----------------------
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
remixLib
=
require
(
'remix-lib'
)
var
styles
=
styleGuide
.
chooser
()
var
styleGuide
=
remixLib
.
ui
.
styleGuide
var
styles
=
styleGuide
()
var
helper
=
require
(
'../../lib/helper'
)
var
helper
=
require
(
'../../lib/helper'
)
var
modal
=
require
(
'../ui/modal-dialog-custom'
)
var
modal
=
require
(
'../ui/modal-dialog-custom'
)
...
@@ -37,6 +37,9 @@ var css = csjs`
...
@@ -37,6 +37,9 @@ var css = csjs`
.select {
.select {
${
styles
.
rightPanel
.
settingsTab
.
dropdown_SelectCompiler
}
${
styles
.
rightPanel
.
settingsTab
.
dropdown_SelectCompiler
}
}
}
.heading {
margin-bottom: 0;
}
input {
input {
margin-right: 3px;
margin-right: 3px;
}
}
...
@@ -86,6 +89,15 @@ function SettingsTab (container, appAPI, appEvents, opts) {
...
@@ -86,6 +89,15 @@ function SettingsTab (container, appAPI, appEvents, opts) {
<input onclick=
${
loadPlugin
}
type="button" value="Load" class="
${
css
.
pluginLoad
}
">
<input onclick=
${
loadPlugin
}
type="button" value="Load" class="
${
css
.
pluginLoad
}
">
</div>
</div>
</div>
</div>
<h4 class="
${
css
.
heading
}
">Themes</h4>
<div class="
${
css
.
crow
}
">
<div><input class="
${
css
.
col1
}
" name="theme" id="themeLight" type="radio"></div>
<span class="
${
css
.
radioText
}
">Light Theme</span>
</div>
<div class="
${
css
.
crow
}
">
<div><input class="
${
css
.
col1
}
" name="theme" id="themeDark" type="radio"></div>
<span class="
${
css
.
radioText
}
">Dark Theme</span>
</div>
</div>
</div>
`
`
...
@@ -124,6 +136,29 @@ function SettingsTab (container, appAPI, appEvents, opts) {
...
@@ -124,6 +136,29 @@ function SettingsTab (container, appAPI, appEvents, opts) {
appAPI
.
setOptimize
(
optimize
,
true
)
appAPI
.
setOptimize
(
optimize
,
true
)
})
})
var
themeStorage
=
new
Storage
(
'style:'
)
var
currTheme
=
themeStorage
.
get
(
'theme'
)
var
themeDark
=
el
.
querySelector
(
'#themeDark'
)
var
themeLight
=
el
.
querySelector
(
'#themeLight'
)
if
(
currTheme
===
'dark'
)
{
themeDark
.
setAttribute
(
'checked'
,
'checked'
)
}
else
{
themeLight
.
setAttribute
(
'checked'
,
'checked'
)
}
themeDark
.
addEventListener
(
'change'
,
function
()
{
console
.
log
(
'change dark theme'
)
styleGuide
.
switchTheme
(
'dark'
)
window
.
location
.
reload
()
})
themeLight
.
addEventListener
(
'change'
,
function
()
{
console
.
log
(
'change to light theme'
)
styleGuide
.
switchTheme
(
'light'
)
window
.
location
.
reload
()
})
// ----------------- version selector-------------
// ----------------- version selector-------------
// clear and disable the version selector
// clear and disable the version selector
...
...
src/app/theme/theme-chooser.js
View file @
c1ccb022
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
styleGuide
=
remixLib
.
ui
.
styleGuide
var
styleGuide
Light
=
remixLib
.
ui
.
styleGuide
var
styleGuideDark
=
remixLib
.
ui
.
styleGuideDark
var
styleGuideDark
=
remixLib
.
ui
.
styleGuideDark
module
.
exports
=
function
()
{
var
Storage
=
require
(
'../../storage'
)
// if (storage.get('theme') === 'light' ) {
module
.
exports
=
{
// return styleGuide
// } else {
// return styleGuideDark
// }
return
styleGuideDark
()
//errors cannot find styleGuideDark
//return styleGuide()
chooser
:
function
()
{
//works
var
themeStorage
=
new
Storage
(
'style:'
)
if
(
themeStorage
.
get
(
'theme'
)
===
'light'
)
{
return
styleGuideLight
()
}
else
{
return
styleGuideDark
()
}
},
//return styleGuide
switchTheme
:
function
(
theme
)
{
// does not work - it needs the prenthesies - to make it return the function
var
themeStorage
=
new
Storage
(
'style:'
)
themeStorage
.
set
(
'theme'
,
theme
)
if
(
theme
===
'dark'
)
{
return
styleGuideDark
()
}
else
if
(
theme
===
'light'
)
{
return
styleGuideLight
()
}
else
{
return
styleGuideLight
()
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment