improve UI of split modals
This commit is contained in:
@@ -15,9 +15,6 @@
|
||||
}
|
||||
|
||||
.split-modal > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
width: 100%;
|
||||
min-width: calc(100% - 4rem);
|
||||
flex: 0;
|
||||
@@ -25,6 +22,25 @@
|
||||
scroll-snap-align: center;
|
||||
}
|
||||
|
||||
.split-modal > div,
|
||||
.split-modal > div > .scroll-area {
|
||||
width: 100%;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
align-items: stretch;
|
||||
justify-content: safe center;
|
||||
}
|
||||
|
||||
.split-modal[navigation] > div > .scroll-area{
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
.split-modal[navigation] > div {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.split-modal .scroll-area {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
@@ -33,6 +49,10 @@
|
||||
padding: var(--content-padding);
|
||||
}
|
||||
|
||||
.split-modal[navigation] > div:nth-child(2) > .flex-row > button {
|
||||
transform: translateX(calc(-1 * var(--content-padding)));
|
||||
}
|
||||
|
||||
.split-modal .detail-button-wrapper {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
@@ -58,12 +78,16 @@
|
||||
min-width: unset;
|
||||
}
|
||||
|
||||
.split-modal:not([primitive]) > div:first-child {
|
||||
.split-modal[navigation] > div {
|
||||
min-width: unset;
|
||||
}
|
||||
|
||||
.split-modal[navigation] > div:first-child {
|
||||
flex: 0;
|
||||
min-width: 20rem;
|
||||
}
|
||||
|
||||
.split-modal[primitive] > div {
|
||||
.split-modal:not([navigation]) > div {
|
||||
width: 50%;
|
||||
min-width: 50%;
|
||||
}
|
||||
@@ -72,3 +96,13 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.split-modal[navigation]:not([page-open]) > div:nth-child(2) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.split-modal[navigation][page-open] > div:first-child {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,53 @@
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
import "./splitModal.css";
|
||||
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
export function SplitModal(
|
||||
export function SplitModal<T>(
|
||||
coreViewModel: CoreViewModel,
|
||||
leftView: React.State<Element>,
|
||||
rightView: React.State<Element>,
|
||||
extendedStyle: boolean = false,
|
||||
navigationState?: React.State<any>,
|
||||
navigationState?: React.State<T | undefined>,
|
||||
) {
|
||||
function closePage() {
|
||||
navigationState.value = undefined;
|
||||
}
|
||||
|
||||
const hasPageOpen = new React.State<boolean>(false);
|
||||
navigationState?.subscribe(
|
||||
(newValue) => (hasPageOpen.value = newValue != undefined),
|
||||
);
|
||||
|
||||
const view = (
|
||||
<div
|
||||
class="split-modal"
|
||||
toggle:extended={extendedStyle}
|
||||
toggle:primitive={navigationState == undefined}
|
||||
toggle:navigation={navigationState != undefined}
|
||||
toggle:page-open={hasPageOpen}
|
||||
>
|
||||
<div>
|
||||
<div class="scroll-area" children:set={leftView}></div>
|
||||
</div>
|
||||
<div class="scroll-area" children:set={rightView}></div>
|
||||
<div class="scroll-area slide-up">
|
||||
<div
|
||||
class="flex-row width-100 mobile-only"
|
||||
toggle:hidden={navigationState == undefined}
|
||||
>
|
||||
<button
|
||||
class="ghost square"
|
||||
aria-label={
|
||||
coreViewModel.translations.general.backButton
|
||||
}
|
||||
on:click={closePage}
|
||||
>
|
||||
<span class="icon">arrow_back</span>
|
||||
</button>
|
||||
</div>
|
||||
<div children:set={rightView}></div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
function scrollToDetails() {
|
||||
view.scrollLeft = view.scrollWidth;
|
||||
}
|
||||
|
||||
navigationState?.subscribe(scrollToDetails);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
import { Languages, ThemeSettings } from "../../Model/Global/settingsModel";
|
||||
import { OptionButtonList } from "../Components/optionButtonList";
|
||||
import { stringify } from "../../Model/Utility/utility";
|
||||
import { PlaceholderView } from "../Components/placeholderView";
|
||||
|
||||
export function SettingsModal(
|
||||
coreViewModel: CoreViewModel,
|
||||
@@ -20,6 +21,11 @@ export function SettingsModal(
|
||||
[settingsViewModel.selectedModalPage],
|
||||
() => {
|
||||
switch (settingsViewModel.selectedModalPage.value) {
|
||||
case undefined: {
|
||||
return PlaceholderView(
|
||||
coreViewModel.translations.general.noPageSelected,
|
||||
);
|
||||
}
|
||||
case SettingsModalPages.Appearance:
|
||||
return SettingsAppearancePane(
|
||||
coreViewModel,
|
||||
@@ -44,6 +50,7 @@ export function SettingsModal(
|
||||
<div>
|
||||
<main class="padding-0">
|
||||
{SplitModal(
|
||||
coreViewModel,
|
||||
new React.State(
|
||||
SettingsLeftPane(coreViewModel, settingsViewModel),
|
||||
),
|
||||
@@ -66,7 +73,8 @@ function SettingsLeftPane(
|
||||
settingsViewModel: SettingsViewModel,
|
||||
) {
|
||||
return (
|
||||
<div class="flex-column gap">
|
||||
<div class="flex-column gap slide-up">
|
||||
<h2>{coreViewModel.translations.homePage.settingsButton}</h2>
|
||||
{SettingsPaneButton(
|
||||
settingsViewModel,
|
||||
SettingsModalPages.Appearance,
|
||||
|
||||
@@ -72,6 +72,7 @@ export function StorageModal(
|
||||
<div>
|
||||
<main class="padding-0">
|
||||
{SplitModal(
|
||||
coreViewModel,
|
||||
new React.State(DirectoryItemList(storageViewModel)),
|
||||
detailView,
|
||||
true,
|
||||
|
||||
@@ -24,6 +24,8 @@ const englishTranslations = {
|
||||
waitingLabel: "Waiting...",
|
||||
|
||||
restoreConnection: "Restore connection",
|
||||
|
||||
noPageSelected: "No page selected",
|
||||
},
|
||||
|
||||
regional: {
|
||||
@@ -328,6 +330,8 @@ export const allTranslations: {
|
||||
waitingLabel: "Warten...",
|
||||
|
||||
restoreConnection: "Verbindung wiederherstellen",
|
||||
|
||||
noPageSelected: "Keine Seite ausgewählt",
|
||||
},
|
||||
|
||||
regional: {
|
||||
@@ -597,6 +601,8 @@ export const allTranslations: {
|
||||
waitingLabel: "Esperando...",
|
||||
|
||||
restoreConnection: "Conectar de nuevo",
|
||||
|
||||
noPageSelected: "No página seleccionada",
|
||||
},
|
||||
|
||||
regional: {
|
||||
|
||||
@@ -8,9 +8,8 @@ export default class SettingsViewModel {
|
||||
username: React.State<string> = new React.State("");
|
||||
usernameInput: React.State<string> = new React.State("");
|
||||
isShowingSettingsModal: React.State<boolean> = new React.State(false);
|
||||
selectedModalPage: React.State<SettingsModalPages> = new React.State(
|
||||
SettingsModalPages.Appearance,
|
||||
);
|
||||
selectedModalPage: React.State<SettingsModalPages | undefined> =
|
||||
new React.State(undefined);
|
||||
requiresReload = new React.State<boolean>(false);
|
||||
|
||||
firstDayOfWeek: React.State<string> = new React.State("0");
|
||||
|
||||
Reference in New Issue
Block a user