Refactor modal window and z-order

This commit is contained in:
IRBorisov 2023-09-05 23:18:21 +03:00
parent b53fe27b1e
commit 120cfdcf03
15 changed files with 50 additions and 22 deletions

View File

@ -4,16 +4,16 @@ import { useConceptTheme } from '../../context/ThemeContext';
interface ConceptTooltipProps interface ConceptTooltipProps
extends Omit<ITooltip, 'variant'> { extends Omit<ITooltip, 'variant'> {
layer?: string
} }
function ConceptTooltip({ className, place='bottom', ...props }: ConceptTooltipProps) { function ConceptTooltip({ className, layer, place='bottom', ...props }: ConceptTooltipProps) {
const { darkMode } = useConceptTheme(); const { darkMode } = useConceptTheme();
return ( return (
<Tooltip <Tooltip
opacity={0.95} opacity={0.95}
className={`overflow-auto border shadow-md z-20 ${className}`} className={`overflow-auto border shadow-md ${layer ?? 'z-tooltip'} ${className}`}
variant={(darkMode ? 'dark' : 'light')} variant={(darkMode ? 'dark' : 'light')}
place={place} place={place}
{...props} {...props}

View File

@ -7,7 +7,7 @@ interface DropdownProps {
function Dropdown({ children, widthClass = 'w-fit', stretchLeft }: DropdownProps) { function Dropdown({ children, widthClass = 'w-fit', stretchLeft }: DropdownProps) {
return ( return (
<div className='relative text-sm'> <div className='relative text-sm'>
<div className={`absolute ${stretchLeft ? 'right-0' : 'left-0'} mt-2 py-1 z-40 flex flex-col items-stretch justify-start origin-top-right border divide-y divide-inherit rounded-md shadow-lg clr-input ${widthClass}`}> <div className={`absolute ${stretchLeft ? 'right-0' : 'left-0'} mt-2 py-1 z-tooltip flex flex-col items-stretch justify-start origin-top-right border divide-y divide-inherit rounded-md shadow-lg clr-input ${widthClass}`}>
{children} {children}
</div> </div>
</div> </div>

View File

@ -37,16 +37,16 @@ function Modal({
return ( return (
<> <>
<div className='fixed top-0 left-0 z-50 w-full h-full clr-modal-backdrop' /> <div className='fixed top-0 left-0 w-full h-full z-navigation clr-modal-backdrop' />
<div <div
ref={ref} ref={ref}
className='fixed bottom-1/2 left-1/2 translate-y-1/2 -translate-x-1/2 px-6 py-4 flex flex-col w-fit max-w-[95vw] h-fit z-[60] clr-app border shadow-md mb-[5rem]' className='fixed bottom-1/2 left-1/2 translate-y-1/2 -translate-x-1/2 px-6 py-4 flex flex-col justify-start w-fit max-w-[calc(100vw-2rem)] h-fit z-modal clr-app border shadow-md'
> >
{ title && <h1 className='mb-2 text-xl'>{title}</h1> } { title && <h1 className='mb-2 text-xl'>{title}</h1> }
<div className='max-h-[calc(95vh-15rem)]'> <div className='max-h-[calc(100vh-8rem)]'>
{children} {children}
</div> </div>
<div className='flex justify-center w-full gap-4 pt-4 mt-2 border-t-2'> <div className='flex justify-center w-full gap-4 pt-4 mt-2 border-t-2 z-modal-top'>
{!readonly && {!readonly &&
<Button <Button
text={submitText} text={submitText}

View File

@ -4,7 +4,7 @@ import { urls } from '../utils/constants';
function Footer() { function Footer() {
return ( return (
<footer className='z-50 px-4 py-2 text-sm select-none whitespace-nowrap clr-footer'> <footer className='px-4 py-2 text-sm select-none z-navigation whitespace-nowrap clr-footer'>
<div className='justify-center w-full mx-auto'> <div className='justify-center w-full mx-auto'>
<div className='mb-2 text-center'> <div className='mb-2 text-center'>
<Link className='mx-2 hover:underline' to='/library' tabIndex={-1}>Библиотека</Link> <Link className='mx-2 hover:underline' to='/library' tabIndex={-1}>Библиотека</Link>

View File

@ -14,11 +14,11 @@ function Navigation () {
const navigateCreateNew = () => navigateTo('/rsform-create'); const navigateCreateNew = () => navigateTo('/rsform-create');
return ( return (
<nav className='sticky top-0 left-0 right-0 z-50 select-none h-fit'> <nav className='sticky top-0 left-0 right-0 select-none z-navigation h-fit'>
{!noNavigation && {!noNavigation &&
<button <button
title='Скрыть навигацию' title='Скрыть навигацию'
className='absolute top-0 right-0 z-[60] w-[1.2rem] h-[3rem] border-b-2 border-l-2 clr-btn-nav rounded-none' className='absolute top-0 right-0 z-navigation w-[1.2rem] h-[3rem] border-b-2 border-l-2 clr-btn-nav rounded-none'
onClick={toggleNoNavigation} onClick={toggleNoNavigation}
tabIndex={-1} tabIndex={-1}
> >
@ -27,7 +27,7 @@ function Navigation () {
{noNavigation && {noNavigation &&
<button <button
title='Показать навигацию' title='Показать навигацию'
className='absolute top-0 right-0 z-[60] px-1 h-[1.6rem] border-b-2 border-l-2 clr-btn-nav rounded-none' className='absolute top-0 right-0 z-navigation px-1 h-[1.6rem] border-b-2 border-l-2 clr-btn-nav rounded-none'
onClick={toggleNoNavigation} onClick={toggleNoNavigation}
tabIndex={-1} tabIndex={-1}
> >

View File

@ -6,7 +6,7 @@ import { getCstTypificationLabel } from '../../utils/staticUI';
function createTooltipFor(cst: IConstituenta) { function createTooltipFor(cst: IConstituenta) {
const dom = document.createElement('div'); const dom = document.createElement('div');
dom.className = 'overflow-y-auto border shadow-md max-h-[25rem] max-w-[25rem] min-w-[10rem] w-fit z-20 text-sm px-2 py-2'; dom.className = 'overflow-y-auto border shadow-md max-h-[25rem] max-w-[25rem] min-w-[10rem] w-fit z-tooltip text-sm px-2 py-2';
const alias = document.createElement('p'); const alias = document.createElement('p');
alias.innerHTML = `<b>${cst.alias}:</b> ${getCstTypificationLabel(cst)}`; alias.innerHTML = `<b>${cst.alias}:</b> ${getCstTypificationLabel(cst)}`;
dom.appendChild(alias); dom.appendChild(alias);

View File

@ -57,6 +57,32 @@
--toastify-color-dark: var(--cd-bg-60); --toastify-color-dark: var(--cd-bg-60);
} }
/* Depth layers */
.z-bottom {
z-index: 0;
}
.z-pop {
z-index: 10;
}
:is(.z-sticky,
.sticky
) {
z-index: 20;
}
.z-tooltip {
z-index: 30;
}
.z-navigation {
z-index: 50;
}
.z-modal {
z-index: 60;
}
.z-modal-top {
z-index: 70;
}
:root { :root {
color: var(--cl-fg-100); color: var(--cl-fg-100);
border-color: var(--cl-bg-40); border-color: var(--cl-bg-40);
@ -142,6 +168,7 @@
:is(.clr-primary, :is(.clr-primary,
.clr-btn-primary:hover, .clr-btn-primary:hover,
.clr-btn-primary:focus,
.clr-checkbox:checked .clr-checkbox:checked
) { ) {
color: var(--cl-prim-fg-100); color: var(--cl-prim-fg-100);

View File

@ -70,7 +70,7 @@ function SearchPanel({ total, filtered, setFilter }: SearchPanelProps) {
}, [strategy, navigateTo]); }, [strategy, navigateTo]);
return ( return (
<div className='sticky top-0 left-0 right-0 z-30 flex items-center justify-start w-full border-b clr-input'> <div className='sticky top-0 left-0 right-0 flex items-center justify-start w-full border-b clr-input'>
<div className='px-2 py-1 select-none whitespace-nowrap min-w-[10rem]'> <div className='px-2 py-1 select-none whitespace-nowrap min-w-[10rem]'>
Фильтр Фильтр
<span className='ml-2'> <span className='ml-2'>

View File

@ -86,7 +86,7 @@ function ViewLibrary({ items, cleanQuery }: ViewLibraryProps) {
return ( return (
<div> <div>
<div className='relative w-full'> <div className='relative w-full'>
<div className='absolute top-0 left-0 z-20 flex gap-1 mt-1 ml-5'> <div className='absolute top-0 left-0 flex gap-1 mt-1 ml-5 z-pop'>
<div id='library-help' className='py-2'> <div id='library-help' className='py-2'>
<HelpIcon color='text-primary' size={6} /> <HelpIcon color='text-primary' size={6} />
</div> </div>

View File

@ -73,7 +73,7 @@ function DlgShowAST({ hideWindow, syntaxTree, expression }: DlgShowASTProps) {
} }
</div> </div>
<div className='flex-wrap w-full h-full overflow-auto'> <div className='flex-wrap w-full h-full overflow-auto'>
<div className='relative w-[1040px] h-[600px] 2xl:w-[1680px] 2xl:h-[600px] max-h-full max-w-full'> <div className='relative' style={{width: 'calc(100vw - 6rem - 2px)', height: 'calc(100vh - 14rem - 2px)'}}>
<GraphCanvas <GraphCanvas
nodes={nodes} nodes={nodes}
edges={edges} edges={edges}

View File

@ -259,7 +259,7 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
return ( return (
<div className='w-full'> <div className='w-full'>
<div <div
className='sticky top-0 z-10 flex justify-start w-full gap-1 px-2 py-1 border-y items-center h-[2.2rem] select-none clr-app' className='sticky top-0 flex justify-start w-full gap-1 px-2 py-1 border-y items-center h-[2.2rem] select-none clr-app'
> >
<div className='mr-3 whitespace-nowrap'> <div className='mr-3 whitespace-nowrap'>
Выбраны Выбраны

View File

@ -360,7 +360,7 @@ function EditorTermGraph({ onOpenEdit, onCreateCst, onDeleteCst }: EditorTermGra
<div className='relative'> <div className='relative'>
<InfoConstituenta <InfoConstituenta
data={hoverCst} data={hoverCst}
className='absolute top-[2.2rem] left-[2.6rem] z-50 w-[25rem] min-h-[11rem] overflow-y-auto border h-fit clr-app px-3' className='absolute top-[2.2rem] left-[2.6rem] z-tooltip w-[25rem] min-h-[11rem] overflow-y-auto border h-fit clr-app px-3'
/> />
</div>} </div>}
@ -465,7 +465,7 @@ function EditorTermGraph({ onOpenEdit, onCreateCst, onDeleteCst }: EditorTermGra
className='relative' className='relative'
style={{width: canvasWidth, height: canvasHeight, borderBottomWidth: noNavigation ? '1px': ''}} style={{width: canvasWidth, height: canvasHeight, borderBottomWidth: noNavigation ? '1px': ''}}
> >
<div className='relative top-0 right-0 z-10 flex mt-1 ml-2 flex-start'> <div className='relative top-0 right-0 flex mt-1 ml-2 z-pop flex-start'>
<div className='px-1 py-1' id='items-graph-help' > <div className='px-1 py-1' id='items-graph-help' >
<HelpIcon color='text-primary' size={5} /> <HelpIcon color='text-primary' size={5} />
</div> </div>

View File

@ -154,7 +154,8 @@ function RSTabsMenu({
<DropdownCheckbox <DropdownCheckbox
value={isForceAdmin} value={isForceAdmin}
onChange={toggleForceAdmin} onChange={toggleForceAdmin}
label='режим администратора' label='Я — администратор!'
tooltip='Режим редактирования для администраторов'
/>} />}
</Dropdown>} </Dropdown>}
</div> </div>

View File

@ -165,7 +165,7 @@ function ViewSideConstituents({ expression, baseHeight, activeID, onOpenEdit }:
}, [noNavigation, baseHeight]); }, [noNavigation, baseHeight]);
return (<> return (<>
<div className='sticky top-0 left-0 right-0 z-10 flex items-start justify-between w-full gap-1 px-2 py-1 border-b rounded clr-input'> <div className='sticky top-0 left-0 right-0 flex items-start justify-between w-full gap-1 px-2 py-1 border-b rounded clr-input'>
<MatchModePicker <MatchModePicker
value={filterMatch} value={filterMatch}
onChange={setFilterMatch} onChange={setFilterMatch}

View File

@ -361,7 +361,7 @@ export const mapTopicInfo: Map<HelpTopic, IDescriptor> = new Map([
tooltip: 'Справка по языку родов структур и экспликации' tooltip: 'Справка по языку родов структур и экспликации'
}], }],
[ HelpTopic.LIBRARY, { [ HelpTopic.LIBRARY, {
text: 'Библиотека:', text: 'Библиотека',
tooltip: 'Интерфейс работы с библиотекой схем' tooltip: 'Интерфейс работы с библиотекой схем'
}], }],
[ HelpTopic.RSFORM, { [ HelpTopic.RSFORM, {