Merge pull request #11 from Lissy93/feature-show-hide-settings

Feature show hide settings
This commit is contained in:
Alicia Sykes 2021-06-03 12:22:12 +01:00 committed by GitHub
commit 2792c83358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 84 additions and 21 deletions

View File

@ -13,7 +13,6 @@ appConfig:
fontAwesomeKey: 0821c65656
sections:
- name: Getting Started
icon: far fa-star
items:
- title: Source
description: Source code and documentation on GitHub

View File

@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="times-circle" class="svg-inline--fa fa-times-circle fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"></path></svg>

After

Width:  |  Height:  |  Size: 712 B

View File

@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="sliders-h" class="svg-inline--fa fa-sliders-h fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"></path></svg>

After

Width:  |  Height:  |  Size: 847 B

View File

@ -34,7 +34,7 @@ footer {
color: var(--medium-grey);
opacity: var(--dimming-factor);
background: var(--background-darker);
margin-top: 7px;
margin-top: 1.5rem;
border-top: 1px solid var(--outline-color);
}

View File

@ -3,8 +3,10 @@
<!-- Button and label -->
<span>Config</span>
<div class="config-buttons">
<IconSpanner v-tooltip="tooltip('Update configuration locally')" @click="showEditor()" />
<IconCloud v-tooltip="tooltip('Backup / restore cloud config')" @click="showCloudModal()" />
<IconSpanner @click="showEditor()" tabindex="-2"
v-tooltip="tooltip('Update configuration locally')" />
<IconCloud @click="showCloudModal()" tabindex="-2"
v-tooltip="tooltip('Backup / restore cloud config')" />
</div>
<!-- Modal containing all the configuration options -->

View File

@ -5,29 +5,40 @@
v-if="searchVisible"
:active="!modalOpen"
/>
<div class="options-container" v-if="settingsVisible">
<ThemeSelector :themes="availableThemes"
:confTheme="getInitialTheme()" :userThemes="getUserThemes()" />
<LayoutSelector :displayLayout="displayLayout" @layoutUpdated="updateDisplayLayout"/>
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
@modalChanged="modalChanged" />
<div class="options-outer">
<div class="options-container" v-if="settingsVisible">
<ThemeSelector :themes="availableThemes"
:confTheme="getInitialTheme()" :userThemes="getUserThemes()" />
<LayoutSelector :displayLayout="displayLayout" @layoutUpdated="updateDisplayLayout"/>
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
@modalChanged="modalChanged" />
</div>
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
<button @click="toggleSettingsVisibility()"
v-tooltip="`${settingsVisible? 'Hide' : 'Open'} Settings Menu`" tabindex="-2">
<IconClose v-if="settingsVisible" />
<IconOpen v-else />
</button>
</div>
</div>
<KeyboardShortcutInfo />
</section>
</template>
<script>
import Defaults from '@/utils/defaults';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import SearchBar from '@/components/Settings/SearchBar';
import ConfigLauncher from '@/components/Settings/ConfigLauncher';
import ThemeSelector from '@/components/Settings/ThemeSelector';
import LayoutSelector from '@/components/Settings/LayoutSelector';
import ItemSizeSelector from '@/components/Settings/ItemSizeSelector';
import KeyboardShortcutInfo from '@/components/Settings/KeyboardShortcutInfo';
import IconOpen from '@/assets/interface-icons/config-open-settings.svg';
import IconClose from '@/assets/interface-icons/config-close.svg';
export default {
name: 'FilterTile',
name: 'SettingsContainer',
props: {
displayLayout: String,
iconSize: String,
@ -44,6 +55,8 @@ export default {
LayoutSelector,
ItemSizeSelector,
KeyboardShortcutInfo,
IconOpen,
IconClose,
},
methods: {
userIsTypingSomething(something) {
@ -70,11 +83,19 @@ export default {
if (typeof userThemes === 'string') return [userThemes];
return userThemes;
},
toggleSettingsVisibility() {
this.settingsVisible = !this.settingsVisible;
localStorage.setItem(localStorageKeys.HIDE_SETTINGS, this.settingsVisible);
},
getSettingsVisibility() {
return JSON.parse(localStorage[localStorageKeys.HIDE_SETTINGS]
|| Defaults.visibleComponents.settings);
},
},
data() {
return {
searchVisible: Defaults.visibleComponents.searchBar && !this.modalOpen,
settingsVisible: Defaults.visibleComponents.settings,
searchVisible: Defaults.visibleComponents.searchBar,
settingsVisible: this.getSettingsVisibility(),
};
},
};
@ -91,13 +112,19 @@ export default {
background: linear-gradient(0deg, var(--background) 0%, var(--background-darker) 100%);
box-shadow: var(--settings-container-shadow);
}
.options-outer {
display: flex;
position: relative;
flex: 1;
background: var(--settings-background);
}
.options-container {
display: flex;
flex-direction: row;
align-items: flex-end;
justify-content: flex-end;
flex: 1;
padding: 0.5rem 1rem;
padding: 0.5rem 1.5rem 0.5rem 1rem;
border-radius: var(--curve-factor-navbar) 0 0;
background: var(--settings-background);
div {
@ -108,6 +135,38 @@ export default {
}
}
.show-hide-container {
display: flex;
// align-items: center;
background: var(--settings-background);
color: var(--settings-text-color);
width: 1.5rem;
position: absolute;
top: 4px;
right: 4px;
&.show-btn {
width: 2rem;
top: 0.5rem;
right: 0.5rem;
}
button {
width: 100%;
padding: 2px 2px 0 2px;
margin: 2px;
border-radius: var(--curve-factor);
height: fit-content;
background: none;
border: none;
color: var(--settings-text-color);
cursor: pointer;
opacity: var(--dimming-factor);
}
&:hover button {
background: var(--settings-text-color);
color: var(--settings-background);
}
}
@include tablet {
section {
display: block;
@ -120,7 +179,7 @@ export default {
}
@include phone {
.options-container {
.options-container, .show-hide-button {
display: none;
}
}

View File

@ -33,7 +33,7 @@ const router = new Router({
appConfig: localAppConfig || appConfig || {},
},
meta: {
title: 'Home Page',
title: pageInfo.title || 'Home Page',
metaTags: [
{
name: 'description',

View File

@ -298,9 +298,6 @@ html[data-theme='material'], html[data-theme='material-dark'] {
max-height: 6rem;
margin: 0.2rem;
padding: 0.5rem;
.overflow-dots {
display: none;
}
img {
padding: 0.1rem 0.25rem;
}
@ -355,6 +352,9 @@ html[data-theme='material'], html[data-theme='material-dark'] {
div {
transition: all 0.2s linear 0s;
}
.overflow-dots {
display: none;
}
&:before {
content: "\f054";
font-family: FontAwesome;

View File

@ -53,6 +53,7 @@ module.exports = {
APP_CONFIG: 'appConfig',
BACKUP_ID: 'backupId',
BACKUP_HASH: 'backupHash',
HIDE_SETTINGS: 'hideSettings',
},
modalNames: {
CONF_EDITOR: 'CONF_EDITOR',