Enhanced the settings UI structure.

The left side of the settings UI now has a more comprehensive layout.
Settings tabs now scroll all the way to the frame bar. When the content is scrolled out of view, a drop shadow is displayed. This removes the awkward feel of content scrolling into nothing.
This commit is contained in:
Daniel Scalzi 2018-06-20 07:38:53 -04:00
parent 5a16416db5
commit e2e48f6444
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9
3 changed files with 69 additions and 21 deletions

View File

@ -886,22 +886,38 @@ body, button {
background: rgba(0, 0, 0, 0.50); background: rgba(0, 0, 0, 0.50);
} }
/* Drop shadow displayed when content is scrolled out of view. */
#settingsContainer:before {
content: '';
background: linear-gradient(rgba(0, 0, 0, 0.25), transparent);
width: 100%;
height: 5px;
position: absolute;
opacity: 0;
transition: opacity 0.25s ease;
}
#settingsContainer[scrolled]:before {
opacity: 1;
}
/* Left hand side of the settings UI, for navigation. */ /* Left hand side of the settings UI, for navigation. */
#settingsContainerLeft { #settingsContainerLeft {
padding-top: 4%;
height: 100%; height: 100%;
width: 25%; width: 25%;
padding: 5% 0px;
box-sizing: border-box; box-sizing: border-box;
} }
/* Settings navigation container. */ /* Settings navigation container. */
#settingsNavContainer { #settingsNavContainer {
height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
/* Navigation header styles. */ /* Navigation header styles. */
#settingsNavHeader { #settingsNavHeader {
height: 15%;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
@ -911,15 +927,15 @@ body, button {
/* Navigation items outer container. */ /* Navigation items outer container. */
#settingsNavItemsContainer { #settingsNavItemsContainer {
height: 100%; height: 85%;
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 25%;
box-sizing: border-box; box-sizing: border-box;
} }
/* Navigation items content container. */ /* Navigation items content container. */
#settingsNavItemsContent { #settingsNavItemsContent {
height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
@ -956,14 +972,14 @@ body, button {
/* Content container for the done button. */ /* Content container for the done button. */
#settingsNavContentBottom { #settingsNavContentBottom {
position: absolute; position: absolute;
bottom: 20%; top: 65%;
} }
/* Settings navigational divider. */ /* Settings navigational divider. */
.settingsNavDivider { .settingsNavDivider {
width: 75%; width: 75%;
height: 0.5px; height: 1px;
background: rgba(255, 255, 255, 0.75); background: rgba(126, 126, 126, 0.57);
margin-left: auto; margin-left: auto;
margin-bottom: 25px; margin-bottom: 25px;
} }
@ -997,7 +1013,6 @@ body, button {
#settingsContainerRight { #settingsContainerRight {
height: 100%; height: 100%;
width: 75%; width: 75%;
padding-top: 5%;
box-sizing: border-box; box-sizing: border-box;
} }
@ -1018,6 +1033,11 @@ body, button {
box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.50); box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.50);
} }
/* Add spacing to the top of each settings tab. */
.settingsTab > *:first-child {
margin-top: 5%;
}
/* Tab header shared styles. */ /* Tab header shared styles. */
.settingsTabHeader { .settingsTabHeader {
display: flex; display: flex;

View File

@ -142,27 +142,54 @@ function saveSettingsValues(){
let selectedTab = 'settingsTabAccount' let selectedTab = 'settingsTabAccount'
/**
* Modify the settings container UI when the scroll threshold reaches
* a certain poin.
*
* @param {UIEvent} e The scroll event.
*/
function settingsTabScrollListener(e){
if(e.target.scrollTop > Number.parseFloat(getComputedStyle(e.target.firstElementChild).marginTop)){
document.getElementById('settingsContainer').setAttribute('scrolled', '')
} else {
document.getElementById('settingsContainer').removeAttribute('scrolled')
}
}
/** /**
* Bind functionality for the settings navigation items. * Bind functionality for the settings navigation items.
*/ */
function setupSettingsTabs(){ function setupSettingsTabs(){
Array.from(document.getElementsByClassName('settingsNavItem')).map((val) => { Array.from(document.getElementsByClassName('settingsNavItem')).map((val) => {
val.onclick = (e) => { if(val.hasAttribute('rSc')){
if(val.hasAttribute('selected')){ val.onclick = (e) => {
return if(val.hasAttribute('selected')){
} return
const navItems = document.getElementsByClassName('settingsNavItem')
for(let i=0; i<navItems.length; i++){
if(navItems[i].hasAttribute('selected')){
navItems[i].removeAttribute('selected')
} }
const navItems = document.getElementsByClassName('settingsNavItem')
for(let i=0; i<navItems.length; i++){
if(navItems[i].hasAttribute('selected')){
navItems[i].removeAttribute('selected')
}
}
val.setAttribute('selected', '')
let prevTab = selectedTab
selectedTab = val.getAttribute('rSc')
document.getElementById(prevTab).onscroll = null
document.getElementById(selectedTab).onscroll = settingsTabScrollListener
$(`#${prevTab}`).fadeOut(250, () => {
$(`#${selectedTab}`).fadeIn({
duration: 250,
start: () => {
settingsTabScrollListener({
target: document.getElementById(selectedTab)
})
}
})
})
} }
val.setAttribute('selected', '')
let prevTab = selectedTab
selectedTab = val.getAttribute('rSc')
$(`#${prevTab}`).fadeOut(250, () => {
$(`#${selectedTab}`).fadeIn(250)
})
} }
}) })
} }

View File

@ -13,6 +13,7 @@
<button class="settingsNavItem" rSc="settingsTabLauncher">Launcher</button> <button class="settingsNavItem" rSc="settingsTabLauncher">Launcher</button>
<div class="settingsNavSpacer"></div> <div class="settingsNavSpacer"></div>
<button class="settingsNavItem" rSc="settingsTabAbout">About</button> <button class="settingsNavItem" rSc="settingsTabAbout">About</button>
<button class="settingsNavItem">Updates</button>
<div id="settingsNavContentBottom"> <div id="settingsNavContentBottom">
<div class="settingsNavDivider"></div> <div class="settingsNavDivider"></div>
<button id="settingsNavDone">Done</button> <button id="settingsNavDone">Done</button>