popup page

This commit is contained in:
Tsanie Lily 2023-04-10 08:33:10 +08:00
parent f85d4c9903
commit fecaf6f450
5 changed files with 39 additions and 2 deletions

View File

@ -51,6 +51,7 @@ $buttonHeight: 36px;
padding: 4px; padding: 4px;
cursor: pointer; cursor: pointer;
box-sizing: border-box; box-sizing: border-box;
transition: opacity .12s ease;
&:hover { &:hover {
opacity: .8; opacity: .8;
@ -75,10 +76,13 @@ $buttonHeight: 36px;
margin-left: 8px; margin-left: 8px;
border: none; border: none;
height: $buttonHeight; height: $buttonHeight;
line-height: $buttonHeight;
padding: 0 8px; padding: 0 8px;
min-width: 60px; min-width: 60px;
text-align: center;
cursor: pointer; cursor: pointer;
background-color: var(--title-bg-color); background-color: var(--title-bg-color);
transition: opacity .12s ease;
&:hover { &:hover {
opacity: .8; opacity: .8;

View File

@ -1,4 +1,5 @@
@import './checkbox.scss'; @import './checkbox.scss';
@import './dropdown.scss'; @import './dropdown.scss';
@import './tooltip.scss'; @import './tooltip.scss';
@import './grid.scss'; @import './grid.scss';
@import './popup.scss';

View File

@ -22,6 +22,7 @@
<li data-page="lib/ui/tooltip.html">tooltip</li> <li data-page="lib/ui/tooltip.html">tooltip</li>
<li data-page="lib/ui/dropdown.html">dropdown</li> <li data-page="lib/ui/dropdown.html">dropdown</li>
<li data-page="lib/ui/grid.html">grid</li> <li data-page="lib/ui/grid.html">grid</li>
<li data-page="lib/ui/popup.html">popup</li>
</ol> </ol>
</li> </li>
<li class="title">lib-utility</li> <li class="title">lib-utility</li>

View File

@ -4,6 +4,7 @@ import { createCheckbox, resolveCheckbox } from "./ui/checkbox";
import { setTooltip, resolveTooltip } from "./ui/tooltip"; import { setTooltip, resolveTooltip } from "./ui/tooltip";
import Dropdown from "./ui/dropdown"; import Dropdown from "./ui/dropdown";
import Grid from "./ui/grid"; import Grid from "./ui/grid";
import { createPopup } from "./ui/popup";
export { export {
// icon // icon
@ -18,5 +19,7 @@ export {
// dropdown // dropdown
Dropdown, Dropdown,
// grid // grid
Grid Grid,
// popup
createPopup
} }

28
lib/ui/popup.html Normal file
View File

@ -0,0 +1,28 @@
<div>
<h1>popup</h1>
<hr />
<p>
创建弹出窗口。
</p>
<hr />
<h2>示例</h2>
<div id="popup-sample">
<button id="button-popup">Popup</button>
</div>
<script type="text/javascript">
const ui = window['lib-ui'];
document.querySelector('#button-popup').addEventListener('click', () => {
const popup = ui.createPopup('title', 'content',
{ text: 'Ok', trigger: () => true });
document.body.appendChild(popup);
setTimeout(() => popup.style.opacity = 1);
});
</script>
<style type="text/css">
:root {
--title-bg-color: lightgray;
--title-color: #333;
}
</style>
</div>