Skip to content

Commit

Permalink
Fix some visual issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jun 12, 2024
1 parent 382c40d commit 483bd83
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ body,
width: 300px;
bottom: 0;
overflow-y: auto;
overscroll-behavior: none;
word-break: break-all;
}

Expand All @@ -42,13 +43,19 @@ body,
border-bottom: 1px solid #e0e0e0;
position: sticky;
top: 0;
z-index: 1;
}

.dataviews-filters__container {
row-gap: 0 !important;
}

#sidebar-bottom {
position: sticky;
bottom: 0;
padding: 7px;
border-top: 1px solid #e0e0e0;
padding-bottom: calc(env(safe-area-inset-bottom) + 7px);
}

.dataviews-wrapper {
Expand Down Expand Up @@ -99,6 +106,8 @@ ul.dataviews-view-list li {
#content {
height: 100%;
background: white;
position: relative;
z-index: 1;
}

#select {
Expand All @@ -125,6 +134,15 @@ ul.dataviews-view-list li {
display: block !important;
}

#editor.has-overlay::after {
content: "";
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}

.block-editor-iframe__container,
.block-editor-iframe__scale-container {
height: 100%
Expand Down
12 changes: 11 additions & 1 deletion src/list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ export default function Frame({ selectedFolderURL, setSelectedFolderURL }) {
return null;
}

const isWide = width > 900;
const currentItem = items.find(({ id }) => id === currentId);
const animation = {
x: isSidebarOpen ? 300 : -1,
width: isSidebarOpen && width > 900 ? 'calc(100% - 300px)' : '100%',
width: isSidebarOpen && isWide ? 'calc(100% - 300px)' : '100%',
};

return (
Expand All @@ -83,6 +84,8 @@ export default function Frame({ selectedFolderURL, setSelectedFolderURL }) {
setItem={setItem}
currentId={currentId}
setCurrentId={setCurrentId}
setIsSidebarOpen={setIsSidebarOpen}
isWide={isWide}
/>
<div id="sidebar-bottom">
<Button
Expand Down Expand Up @@ -133,6 +136,7 @@ export default function Frame({ selectedFolderURL, setSelectedFolderURL }) {
/>
</ToolbarGroup>
</div>
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
<div
id="editor"
style={{
Expand All @@ -143,6 +147,12 @@ export default function Frame({ selectedFolderURL, setSelectedFolderURL }) {
display: 'flex',
flexDirection: 'column',
}}
onClick={() => {
if (!isWide) {
setIsSidebarOpen(false);
}
}}
className={isSidebarOpen && !isWide ? 'has-overlay' : ''}
>
{currentItem.blocks && (
<Editor
Expand Down
12 changes: 11 additions & 1 deletion src/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ function Title({ item: { path, blocks } }) {
return title ? decodeURIComponent(title) : <em>{__('Untitled')}</em>;
}

export default function SiderBar({ items, setItem, currentId, setCurrentId }) {
export default function SiderBar({
items,
setItem,
currentId,
setCurrentId,
setIsSidebarOpen,
isWide,
}) {
const [view, setView] = useState({
type: 'list',
search: '',
Expand Down Expand Up @@ -104,6 +111,9 @@ export default function SiderBar({ items, setItem, currentId, setCurrentId }) {
if (item) {
setCurrentId(item.id);
setItem(currentId, { blocks: null });
if (!isWide) {
setIsSidebarOpen(false);
}
}
}}
supportedLayouts={['list']}
Expand Down

0 comments on commit 483bd83

Please sign in to comment.