Add dark theme

This commit is contained in:
Ramires Viana
2020-01-02 00:48:48 +00:00
committed by Henrique Dias
parent cc7ec4f0c5
commit 55a9d945cc
9 changed files with 183 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import buttons from '@/utils/buttons'
import ace from 'ace-builds/src-min-noconflict/ace.js'
import modelist from 'ace-builds/src-min-noconflict/ext-modelist.js'
import 'ace-builds/webpack-resolver'
import { theme } from '@/utils/constants'
export default {
name: 'editor',
@@ -45,6 +46,10 @@ export default {
mode: modelist.getModeForPath(this.req.name).mode,
wrap: true
})
if (theme == 'dark') {
this.editor.setTheme("ace/theme/twilight");
}
},
methods: {
keyEvent (event) {

View File

@@ -0,0 +1,18 @@
<template>
<select v-on:change="change" :value="theme">
<option value="">{{ $t('settings.themes.light') }}</option>
<option value="dark">{{ $t('settings.themes.dark') }}</option>
</select>
</template>
<script>
export default {
name: 'themes',
props: [ 'theme' ],
methods: {
change (event) {
this.$emit('update:theme', event.target.value)
}
}
}
</script>

View File

@@ -119,6 +119,11 @@
"newArchetype": "Create a new post based on an archetype. Your file will be created on content folder."
},
"settings": {
"themes": {
"title": "Theme",
"light": "Light",
"dark": "Dark"
},
"instanceName": "Instance name",
"brandingDirectoryPath": "Branding directory path",
"documentation": "documentation",

View File

@@ -9,6 +9,7 @@ const version = window.FileBrowser.Version
const logoURL = `/${staticURL}/img/logo.svg`
const noAuth = window.FileBrowser.NoAuth
const loginPage = window.FileBrowser.LoginPage
const theme = window.FileBrowser.Theme
export {
name,
@@ -20,5 +21,6 @@ export {
signup,
version,
noAuth,
loginPage
loginPage,
theme
}

View File

@@ -29,6 +29,11 @@
{{ $t('settings.disableExternalLinks') }}
</p>
<p>
<label for="theme">{{ $t('settings.themes.title') }}</label>
<themes class="input input--block" :theme.sync="settings.branding.theme" id="theme"></themes>
</p>
<p>
<label for="branding-name">{{ $t('settings.instanceName') }}</label>
<input class="input input--block" type="text" v-model="settings.branding.name" id="branding-name" />
@@ -98,10 +103,12 @@ import { mapState } from 'vuex'
import { settings as api } from '@/api'
import UserForm from '@/components/settings/UserForm'
import Rules from '@/components/settings/Rules'
import Themes from '@/components/settings/Themes'
export default {
name: 'settings',
components: {
Themes,
UserForm,
Rules
},