Update more pages to be responsive and add mobile specific components

This commit is contained in:
Andrew Kingston 2023-01-11 09:11:35 +00:00
parent db4714d69c
commit 34adcdcddf
5 changed files with 86 additions and 22 deletions

View File

@ -72,6 +72,7 @@
background: var(--background); background: var(--background);
border-left: var(--border-light); border-left: var(--border-light);
width: 320px; width: 320px;
max-width: calc(100vw - 48px - 48px);
overflow: auto; overflow: auto;
overflow-x: hidden; overflow-x: hidden;
transform: translateX(100%); transform: translateX(100%);

View File

@ -1,9 +1,10 @@
<script> <script>
export let narrow = false export let narrow = false
export let showMobileNav = false
</script> </script>
<div class="content"> <div class="content">
<div class="side-nav"> <div class="side-nav" class:show-mobile={showMobileNav}>
<slot name="side-nav" /> <slot name="side-nav" />
</div> </div>
<div class="main" class:narrow> <div class="main" class:narrow>
@ -28,4 +29,13 @@
.main.narrow { .main.narrow {
max-width: 600px; max-width: 600px;
} }
@media (max-width: 640px) {
.content {
flex-direction: column;
}
.side-nav:not(.show-mobile) {
display: none;
}
}
</style> </style>

View File

@ -2,9 +2,10 @@
import { Heading } from "@budibase/bbui" import { Heading } from "@budibase/bbui"
export let title export let title
export let wrap = true
</script> </script>
<div class="header"> <div class="header" class:wrap>
<slot name="icon" /> <slot name="icon" />
<Heading size="L">{title}</Heading> <Heading size="L">{title}</Heading>
<div class="buttons"> <div class="buttons">
@ -20,10 +21,19 @@
align-items: center; align-items: center;
gap: var(--spacing-xl); gap: var(--spacing-xl);
} }
.header.wrap {
flex-wrap: wrap;
}
.header :global(.spectrum-Heading) { .header :global(.spectrum-Heading) {
flex: 1 1 auto; flex: 1 1 auto;
margin-top: -2px; margin-top: -2px;
} }
.header:not(.wrap) :global(.spectrum-Heading) {
overflow: hidden;
width: 0;
white-space: nowrap;
text-overflow: ellipsis;
}
.buttons { .buttons {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -34,4 +44,9 @@
.buttons :global(> div) { .buttons :global(> div) {
display: contents; display: contents;
} }
@media (max-width: 640px) {
.wrap .buttons {
margin-bottom: var(--spacing-m);
}
}
</style> </style>

View File

@ -23,4 +23,12 @@
color: var(--spectrum-global-color-gray-700); color: var(--spectrum-global-color-gray-700);
margin-bottom: var(--spacing-m); margin-bottom: var(--spacing-m);
} }
@media (max-width: 640px) {
.side-nav {
border-bottom: var(--border-light);
margin: 0 -24px;
padding: 0 24px 32px 24px;
}
}
</style> </style>

View File

@ -120,7 +120,7 @@
<Breadcrumb url={$url("../")} text="Apps" /> <Breadcrumb url={$url("../")} text="Apps" />
<Breadcrumb text={app?.name} /> <Breadcrumb text={app?.name} />
</Breadcrumbs> </Breadcrumbs>
<Header title={app?.name}> <Header title={app?.name} wrap={false}>
<div slot="icon"> <div slot="icon">
<EditableIcon <EditableIcon
{app} {app}
@ -132,28 +132,46 @@
</div> </div>
<div slot="buttons"> <div slot="buttons">
<AppLockModal {app} /> <AppLockModal {app} />
<Button <span class="desktop">
size="M" <Button
quiet size="M"
secondary quiet
disabled={!isPublished} secondary
on:click={viewApp} disabled={!isPublished}
dataCy="view-app" on:click={viewApp}
> dataCy="view-app"
View >
</Button> View
<Button </Button>
size="M" </span>
cta <span class="desktop">
disabled={appLocked && !lockedByYou} <Button
on:click={editApp} size="M"
> cta
Edit disabled={appLocked && !lockedByYou}
</Button> on:click={editApp}
>
Edit
</Button>
</span>
<ActionMenu align="right" dataCy="app-overview-menu-popover"> <ActionMenu align="right" dataCy="app-overview-menu-popover">
<span slot="control" class="app-overview-actions-icon"> <span slot="control" class="app-overview-actions-icon">
<Icon hoverable name="More" /> <Icon hoverable name="More" />
</span> </span>
<span class="mobile">
<MenuItem icon="Globe" disabled={!isPublished} on:click={viewApp}>
View
</MenuItem>
</span>
<span class="mobile">
<MenuItem
icon="Edit"
disabled={appLocked && !lockedByYou}
on:click={editApp}
>
Edit
</MenuItem>
</span>
<MenuItem <MenuItem
on:click={() => exportApp({ published: false })} on:click={() => exportApp({ published: false })}
icon="DownloadFromCloud" icon="DownloadFromCloud"
@ -177,7 +195,7 @@
</ActionMenu> </ActionMenu>
</div> </div>
</Header> </Header>
<Content> <Content showMobileNav>
<SideNav slot="side-nav"> <SideNav slot="side-nav">
<SideNavItem <SideNavItem
text="Overview" text="Overview"
@ -237,3 +255,15 @@
/> />
</ConfirmDialog> </ConfirmDialog>
{/key} {/key}
<style>
.desktop {
display: contents;
}
@media (max-width: 640px) {
.desktop {
display: none;
}
}
</style>