1
0
Fork 0
mirror of synced 2024-09-20 03:08:18 +12:00
budibase/packages/bbui/src/Modal/Modal.svench
Andrew Kingston d92f1a7097 Portal redesign (#9336)
* Update BB logo to black

* Update top nav bar and core layout

* Add redesign for apps pages

* Update user and groups pages

* More WIP portal redesign!

* Fix top nav colours and fix selected tab not updating

* Remove log

* Update copy on settings pages

* Update and standardise page headers and subtitles, and remove side nav titles

* Update font styles to allow for easy customisation

* Update button styles to always use newStyles, update auth page styles

* Update settings pages to new designs

* Update structure for account pages

* Add initial rewrite of app overview section

* Update config checklist to properly center

* Update app overview version and name/url screens

* Add tooltip to explain why URL cannot be changed until unpublishing

* Update overview automation history tab

* Update overview backups page

* Rewrite app overview access tab

* Update table hover colours

* Remove scrolling from tables when not required and stop selects from updating their own state locally

* Update table styles to support flexible column widths much better

* Fix extremely long strings in breadcrumbs not wrapping

* Fix multiple issues with long text overflow

* Fix flashing in version settings page

* Fix loading bugs in app backups page

* Add sidebar for portal and use it for automation history. Fix multiple overflow and scrolling issues

* Tidy up

* Update user details page to use tables and match designs

* Update users detail page

* Update user and group details pages with new tables

* Fix automation error linking from apps page and improve automation fetching logic in automation history

* Move theme and API key into user profile dropdown instead of settings

* Move settings before account and show plugins for devs

* Convert plugins page to table and update components and modals

* Update links when going back from the builder

* Update plugin search placeholder

* Fix URLs in app overview

* Properly handle text overflow in plugins table

* Remove getting started checklist

* Fix checklist removal and fix profile modal

* Update email details page to match new designs

* Cleanup

* Add licensing and env logic to determine which account links to show

* Update upgrade button URL for cloud accounts

* Update app list to use a more compact style

* Make core page layout responsive and update apps list to be responsive

* Update mobile design of apps page

* Update more pages to be responsive and add mobile specific components

* Refactor main portal page into multiple components

* Update multiple pages to be responsive and improve loading experience

* Make automation history page responsive

* Update backups page to be responsive

* Update pickers to use absolutely positioned root popover so that overflow does not matter

* Fix some responsive styles

* Fix update link in app overview

* Improve dropdown logic

* Lint

* Update click outside handler to handle modals properly

* Remove log

* Fix mobile menu upgrade button not closing menu

* Hide groups page if disabled at tenant level

* Centralise menu logic and show full menu on mobile

* Update app access assignment and fix backups table

* Ensure avatars cannot be squished

* Standardise disabled field text colour

* Allow developer users to access users, groups and usage pages

* Allow readonly access to users and groups for developer users

* Remove logs

* Improve users page loading experience

* Improve responsiveness on apps list page and fix discussions link styles

* Update spacing on user and group detail page and fix usage page showing wrong copy

* Fix logo override not working

* Pin minio version to an old one that supports the fs backend in dev

* Shrink upgrade button

* Shrink user dropdown

* Update assignment modal text

* Remove clickable visual styles from plugins

* Always show groups section in app access page

* Update app overview button styles to include more CTAs

* Hide edit and view links in more menu on overview page unless on mobile

* Make usage stats responsive and fix layout issues

* Add comment to docker-compose config
2023-01-18 13:56:53 +00:00

116 lines
3.5 KiB
Text

<script>
import { View } from "svench";
import Modal from "./Modal.svelte";
import ModalContent from "./ModalContent.svelte";
import Button from "../Button/Button.svelte";
import Content from "./Content.svelte";
import QuizModal from "./QuizModal.svelte";
import CustomContent from "./CustomContent.svelte";
let modal1
let modal2
let modal3
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
async function longTask() {
await sleep(3000)
}
</script>
<style>
p, span {
font-size: var(--font-size-s);
}
code {
display: inline-block;
box-sizing: border-box;
padding: var(--spacing-xs) var(--spacing-s);
background-color: var(--grey-2);
color: var(--red-dark);
border-radius: var(--spacing-xs);
}
</style>
<h3>Modals</h3>
<p>
Modals provide a means to render content in front of everything else on a page.
</p>
<p>
The modal module in BBUI exposes two
separate components to provide this functionality; a <code>Modal</code> component to control visibility of content,
and a <code>ModalContent</code> component to quickly construct the typical content - although this is optional.
</p>
<p>
One of the common problems with modals and popups is stale state reappearing after hiding and showing the content
again, since the state hasn't been garbage collected if a component controls its own visibility. This is handled for
you when using the <code>Modal</code> component as it will fully unmount child components, properly resetting state
every time it appears.
</p>
<br/>
<p>Use ModalContent to render typical modal content.</p>
<View name="Simple Confirmation Modal">
<Button primary on:click={modal1.show}>Delete Record</Button>
<Modal bind:this={modal1}>
<ModalContent title="Confirm Deletion" confirmText="Delete">
<span>Are you sure you want to delete this record?</span>
</ModalContent>
</Modal>
</View>
<br/>
<p>
Width can be specified as a prop to a <code>Modal</code>. Any additional <code>ModalContent</code> props provided
will be passed to the confirmation button.
</p>
<View name="Different Buttons and Width">
<Button primary on:click={modal3.show}>Open Modal</Button>
<Modal bind:this={modal3} width="250px">
<ModalContent
title="Confirmation Required"
showCancelButton={false}
showCloseIcon={false}
confirmText="I'm sure!"
green
large
wide
>
<span>Are you sure you want to do that?</span>
</ModalContent>
</Modal>
</View>
<br/>
<p>Any content can be rendered inside a <code>Modal</code>. Use context to close the modal from your own components.</p>
<View name="Custom Content">
<Button primary on:click={modal1.show}>Open Modal</Button>
<Modal bind:this={modal1} padding={false} border={false}>
<CustomContent/>
</Modal>
</View>
<br/>
<p>Async functions passed in as the onConfirm prop will make the modal wait until the callback is completed.</p>
<View name="Async Callbacks">
<Button primary on:click={modal2.show}>Long Task</Button>
<Modal bind:this={modal2}>
<ModalContent
title="Perform Long Task"
confirmText="Submit"
onConfirm={longTask}
>
<span>Pressing submit will wait 3 seconds before finishing and disable the confirm button until it's done.</span>
</ModalContent>
</Modal>
</View>
<br/>
<p>Returning false from a onConfirm callback will prevent the modal being closed.</p>
<View name="Callback Failure Handling">
<Button primary on:click={modal3.show}>Open Quiz</Button>
<Modal bind:this={modal3}>
<QuizModal />
</Modal>
</View>