Adds more themes, adds ability to hide unneeded components

This commit is contained in:
Alicia Sykes 2021-04-16 14:29:19 +01:00
parent 7f3e8dd818
commit c5f630849f
12 changed files with 116 additions and 51 deletions

View File

@ -2,13 +2,14 @@
<div id="dashy" data-theme="dark"> <div id="dashy" data-theme="dark">
<Header :pageInfo="getPageInfo(pageInfo)" /> <Header :pageInfo="getPageInfo(pageInfo)" />
<router-view /> <router-view />
<Footer /> <Footer v-if="showFooter" />
</div> </div>
</template> </template>
<script> <script>
import Header from '@/components/PageStrcture/Header.vue'; import Header from '@/components/PageStrcture/Header.vue';
import Footer from '@/components/PageStrcture/Footer.vue'; import Footer from '@/components/PageStrcture/Footer.vue';
import Defaults from '@/utils/defaults';
import conf from '@/data/conf.yml'; import conf from '@/data/conf.yml';
export default { export default {
@ -19,6 +20,7 @@ export default {
}, },
data: () => ({ data: () => ({
pageInfo: conf.pageInfo, pageInfo: conf.pageInfo,
showFooter: Defaults.visibleComponents.footer,
}), }),
methods: { methods: {
/* Returns either page info from the config, or default values */ /* Returns either page info from the config, or default values */

View File

@ -93,7 +93,7 @@ export default {
padding: var(--item-group-padding); padding: var(--item-group-padding);
margin: 10px; margin: 10px;
border-radius: var(--curve-factor); border-radius: var(--curve-factor);
background: var(--primary); background: var(--item-group-outer-background);
box-shadow: var(--item-group-shadow); box-shadow: var(--item-group-shadow);
height: fit-content; height: fit-content;
width: 100%; width: 100%;
@ -140,7 +140,7 @@ export default {
border-radius: var(--curve-factor); border-radius: var(--curve-factor);
transition: all 0.25s ease-out; transition: all 0.25s ease-out;
text-align: left; text-align: left;
color: var(--item-group-background); color: var(--item-group-heading-text-color); //var(--item-group-background);
h3 { h3 {
margin: 0; margin: 0;
@ -150,7 +150,7 @@ export default {
} }
.lbl-toggle:hover { .lbl-toggle:hover {
color: var(--background); color: var(--item-group-heading-text-color-hover);
} }
.lbl-toggle::before { .lbl-toggle::before {

View File

@ -97,7 +97,7 @@ export default {
.item { .item {
flex-grow: 1; flex-grow: 1;
position: relative; position: relative;
color: var(--primary); color: var(--item-text-color);
vertical-align: middle; vertical-align: middle;
margin: 0.5rem; margin: 0.5rem;
background: var(--item-background); background: var(--item-background);

View File

@ -43,7 +43,8 @@ export default {
width: 1rem; width: 1rem;
margin: 2px; margin: 2px;
path { path {
fill: var(--primary); // fill: var(--primary);
fill: currentColor;
} }
} }
&.top svg { top: 0; } &.top svg { top: 0; }

View File

@ -1,13 +1,14 @@
<template> <template>
<header> <header>
<PageTitle :title="pageInfo.title" :description="pageInfo.description" /> <PageTitle :title="pageInfo.title" :description="pageInfo.description" v-if="titleVisible" />
<Nav class="nav"/> <Nav class="nav" v-if="navVisible" />
</header> </header>
</template> </template>
<script> <script>
import PageTitle from '@/components/PageStrcture/PageTitle.vue'; import PageTitle from '@/components/PageStrcture/PageTitle.vue';
import Nav from '@/components/PageStrcture/Nav.vue'; import Nav from '@/components/PageStrcture/Nav.vue';
import Defaults from '@/utils/defaults';
export default { export default {
name: 'Header', name: 'Header',
@ -18,6 +19,12 @@ export default {
props: { props: {
pageInfo: Object, pageInfo: Object,
}, },
data() {
return {
titleVisible: Defaults.visibleComponents.pageTitle,
navVisible: Defaults.visibleComponents.navigation,
};
},
}; };
</script> </script>

View File

@ -2,8 +2,8 @@
<div> <div>
<span class="options-label">Layout</span> <span class="options-label">Layout</span>
<div class="display-options"> <div class="display-options">
<IconDeafault @click="updateDisplayLayout('default')" v-tooltip="tooltip('Auto')" <IconDeafault @click="updateDisplayLayout('auto')" v-tooltip="tooltip('Auto')"
:class="`layout-icon ${displayLayout === 'default' ? 'selected' : ''}`" tabindex="2" /> :class="`layout-icon ${displayLayout === 'auto' ? 'selected' : ''}`" tabindex="2" />
<IconHorizontal @click="updateDisplayLayout('horizontal')" v-tooltip="tooltip('Horizontal')" <IconHorizontal @click="updateDisplayLayout('horizontal')" v-tooltip="tooltip('Horizontal')"
:class="`layout-icon ${displayLayout === 'horizontal' ? 'selected' : ''}`" tabindex="2" /> :class="`layout-icon ${displayLayout === 'horizontal' ? 'selected' : ''}`" tabindex="2" />
<IconVertical @click="updateDisplayLayout('vertical')" v-tooltip="tooltip('Vertical')" <IconVertical @click="updateDisplayLayout('vertical')" v-tooltip="tooltip('Vertical')"

View File

@ -1,8 +1,9 @@
<template> <template>
<section> <section>
<SearchBar @user-is-searchin="userIsTypingSomething" ref="SearchBar" /> <SearchBar @user-is-searchin="userIsTypingSomething" ref="SearchBar" v-if="searchVisible" />
<div class="options-container"> <div class="options-container" v-if="settingsVisible">
<ThemeSelector :themes="availableThemes" :confTheme="getInitialTheme()"/> <ThemeSelector :themes="availableThemes"
:confTheme="getInitialTheme()" :userThemes="getUserThemes()" />
<LayoutSelector :displayLayout="displayLayout" @layoutUpdated="updateDisplayLayout"/> <LayoutSelector :displayLayout="displayLayout" @layoutUpdated="updateDisplayLayout"/>
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" /> <ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
</div> </div>
@ -11,6 +12,7 @@
</template> </template>
<script> <script>
import Defaults from '@/utils/defaults';
import SearchBar from '@/components/Settings/SearchBar'; import SearchBar from '@/components/Settings/SearchBar';
import ThemeSelector from '@/components/Settings/ThemeSelector'; import ThemeSelector from '@/components/Settings/ThemeSelector';
import LayoutSelector from '@/components/Settings/LayoutSelector'; import LayoutSelector from '@/components/Settings/LayoutSelector';
@ -48,6 +50,15 @@ export default {
getInitialTheme() { getInitialTheme() {
return this.appConfig.theme || ''; return this.appConfig.theme || '';
}, },
getUserThemes() {
return this.appConfig.cssThemes || [];
},
},
data() {
return {
searchVisible: Defaults.visibleComponents.searchBar,
settingsVisible: Defaults.visibleComponents.settings,
};
}, },
}; };
</script> </script>

View File

@ -20,6 +20,7 @@ export default {
props: { props: {
themes: Object, themes: Object,
confTheme: String, confTheme: String,
userThemes: Array,
}, },
watch: { watch: {
selectedTheme(newTheme) { this.updateTheme(newTheme); }, selectedTheme(newTheme) { this.updateTheme(newTheme); },
@ -29,7 +30,7 @@ export default {
selectedTheme: this.getInitialTheme(), selectedTheme: this.getInitialTheme(),
themeHelper: new ThemeHelper(), themeHelper: new ThemeHelper(),
loading: true, loading: true,
builtInThemes: Defaults.builtInThemes, builtInThemes: Defaults.builtInThemes.concat(this.userThemes),
}; };
}, },
computed: { computed: {

View File

@ -1,13 +1,15 @@
:root { :root {
/* Basic*/ /* Basic*/
--background: #0b1021; --primary: #5cabca; // Main accent color
--background-darker: #05070e; --background: #0b1021; // Page background
--primary: #5cabca; --background-darker: #05070e; // Used for navigation bar, footer and fills
/* Modified Colors */ /* Modified Colors */
--item-group-background: #0b1021cc; --item-group-background: #0b1021cc;
--medium-grey: #5e6474; --medium-grey: #5e6474;
--item-background: #607d8b33;
--item-background-hover: #607d8b4d;
/* Semi-Transparent Black*/ /* Semi-Transparent Black*/
--transparent-70: #000000b3; --transparent-70: #000000b3;
@ -16,21 +18,24 @@
/* Other Variables */ /* Other Variables */
--outline-color: none; --outline-color: none;
--curve-factor: 5px; --curve-factor: 5px; // Border radius for most components
--curve-factor-navbar: 16px; --curve-factor-navbar: 16px; // Border radius for header
--dimming-factor: 0.8; --dimming-factor: 0.8; // Opacity for semi-transparent components
/* Settings for specific components */ /* Settings for specific components */
--item-group-padding: 5px; --item-group-padding: 5px; // Determines width of item-group outline
--item-shadow: 1px 1px 2px #130f23; --item-shadow: 1px 1px 2px #130f23;
--item-group-shadow: var(--item-shadow);
--item-hover-shadow: 1px 2px 4px #373737; --item-hover-shadow: 1px 2px 4px #373737;
--item-icon-transform: drop-shadow(2px 4px 6px var(--transparent-50)) saturate(0.65); --item-icon-transform: drop-shadow(2px 4px 6px var(--transparent-50)) saturate(0.65);
--item-icon-transform-hover: drop-shadow(4px 8px 3px var(--transparent-50)) saturate(2); --item-icon-transform-hover: drop-shadow(4px 8px 3px var(--transparent-50)) saturate(2);
--item-group-shadow: var(--item-shadow);
--item-background: #607d8b33; /* Specific components, using variables allows them to be overridden individually */
--item-background-hover: #607d8b4d; --item-text-color: var(--primary);
--settings-text-color: var(--primary); --item-group-outer-background: var(--primary);
--item-group-heading-text-color: var(--item-group-background);
--item-group-heading-text-color-hover: var(--background);
--settings-background: var(--background); --settings-background: var(--background);
--settings-text-color: var(--primary);
--search-container-background: var(--background-darker); --search-container-background: var(--background-darker);
} }

View File

@ -1,26 +1,3 @@
html[data-theme='nord'] {
--primary: #D8DEE9;
--background: #3B4252;
--background-darker: #2E3440;
--item-background: #434C5E;
--item-background-hover: #4C566A;
.collapsable:nth-child(1n) { background: #BF616A; }
.collapsable:nth-child(2n) { background: #D08770; }
.collapsable:nth-child(3n) { background: #EBCB8B; }
.collapsable:nth-child(4n) { background: #A3BE8C; }
}
html[data-theme='nord-frost'] {
--primary: #D8DEE9;
--background: #3B4252;
--background-darker: #2E3440;
--item-background: #434C5E;
--item-background-hover: #4C566A;
.collapsable:nth-child(1n) { background: #8FBCBB; }
.collapsable:nth-child(2n) { background: #88C0D0; }
.collapsable:nth-child(3n) { background: #81A1C1; }
.collapsable:nth-child(4n) { background: #5E81AC; }
}
html[data-theme='callisto'] { html[data-theme='callisto'] {
--background: #141b33; --background: #141b33;
@ -117,6 +94,30 @@ html[data-theme='high-contrast-dark'] {
--curve-factor: 0px; --curve-factor: 0px;
} }
html[data-theme='nord'] {
--primary: #D8DEE9;
--background: #3B4252;
--background-darker: #2E3440;
--item-background: #434C5E;
--item-background-hover: #4C566A;
.collapsable:nth-child(1n) { background: #BF616A; }
.collapsable:nth-child(2n) { background: #D08770; }
.collapsable:nth-child(3n) { background: #EBCB8B; }
.collapsable:nth-child(4n) { background: #A3BE8C; }
}
html[data-theme='nord-frost'] {
--primary: #D8DEE9;
--background: #3B4252;
--background-darker: #2E3440;
--item-background: #434C5E;
--item-background-hover: #4C566A;
.collapsable:nth-child(1n) { background: #8FBCBB; }
.collapsable:nth-child(2n) { background: #88C0D0; }
.collapsable:nth-child(3n) { background: #81A1C1; }
.collapsable:nth-child(4n) { background: #5E81AC; }
}
html[data-theme='material'] { html[data-theme='material'] {
--primary: #29B6F6; --primary: #29B6F6;
--settings-text-color: #01579b; --settings-text-color: #01579b;
@ -136,3 +137,29 @@ html[data-theme='material'] {
--item-icon-transform: drop-shadow(1px 2px 1px var(--transparent-30)) saturate(0.65); --item-icon-transform: drop-shadow(1px 2px 1px var(--transparent-30)) saturate(0.65);
--item-icon-transform-hover: drop-shadow(1px 3px 2px var(--transparent-30)) saturate(2); --item-icon-transform-hover: drop-shadow(1px 3px 2px var(--transparent-30)) saturate(2);
} }
html[data-theme='colorful'] {
--primary: #e8eae1;
--background: #0b1021;
--item-background: #05070e;
--item-background-hover: #0b1021;
--item-group-background: transparent;
--item-group-outer-background: #05070e;
--item-group-heading-text-color: #e8eae1;
--item-group-heading-text-color-hover: #fff;
.item:nth-child(1n) { color: #eb5cad; border: 1px solid #eb5cad; }
.item:nth-child(2n) { color: #985ceb; border: 1px solid #985ceb; }
.item:nth-child(3n) { color: #5c90eb; border: 1px solid #5c90eb; }
.item:nth-child(4n) { color: #5cdfeb; border: 1px solid #5cdfeb; }
.item:nth-child(5n) { color: #5ceb8d; border: 1px solid #5ceb8d; }
.item:nth-child(6n) { color: #afeb5c; border: 1px solid #afeb5c; }
.item:nth-child(7n) { color: #ebb75c; border: 1px solid #ebb75c; }
.item:nth-child(8n) { color: #eb615c; border: 1px solid #eb615c; }
.item:hover, .item:focus {
opacity: 0.85;
outline: none;
background: currentColor;
span { color: #05070e; }
svg path { fill: #05070e; }
}
}

View File

@ -1,5 +1,7 @@
module.exports = { module.exports = {
defaultTheme: 'Default', iconSize: 'medium',
layout: 'auto',
defaultTheme: 'default',
builtInThemes: [ builtInThemes: [
'nord', 'nord',
'nord-frost', 'nord-frost',
@ -13,7 +15,15 @@ module.exports = {
'bee', 'bee',
'raspberry-jam', 'raspberry-jam',
'tiger', 'tiger',
'colorful',
'high-contrast-light', 'high-contrast-light',
'high-contrast-dark', 'high-contrast-dark',
], ],
visibleComponents: {
pageTitle: true,
navigation: true,
searchBar: true,
settings: true,
footer: true,
},
}; };

View File

@ -33,6 +33,7 @@
import SettingsContainer from '@/components/Settings/SettingsContainer.vue'; import SettingsContainer from '@/components/Settings/SettingsContainer.vue';
import ItemGroup from '@/components/LinkItems/ItemGroup.vue'; import ItemGroup from '@/components/LinkItems/ItemGroup.vue';
import Defaults from '@/utils/defaults';
export default { export default {
name: 'home', name: 'home',
@ -51,14 +52,14 @@ export default {
}), }),
computed: { computed: {
layoutOrientation: { layoutOrientation: {
get: () => localStorage.layoutOrientation || 'default', get: () => localStorage.layoutOrientation || Defaults.layout,
set: function setLayout(layout) { set: function setLayout(layout) {
localStorage.setItem('layoutOrientation', layout); localStorage.setItem('layoutOrientation', layout);
this.layout = layout; this.layout = layout;
}, },
}, },
iconSize: { iconSize: {
get: () => localStorage.iconSize || 'medium', get: () => localStorage.iconSize || Defaults.iconSize,
set: function setIconSize(iconSize) { set: function setIconSize(iconSize) {
localStorage.setItem('iconSize', iconSize); localStorage.setItem('iconSize', iconSize);
this.itemSizeBound = iconSize; this.itemSizeBound = iconSize;