Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit f4f188c

Browse files
committed
release(modal): v0.1.2
1 parent 00a2b36 commit f4f188c

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

Diff for: src/modal/index.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ export default class Modal extends Component<IOptions> {
170170
modal.show()
171171
})
172172
}
173+
/**
174+
* Set alert, prompt, confirm container, need to be called first.
175+
* @static
176+
*/
177+
static setContainer(container: HTMLElement) {
178+
globalContainer = container
179+
}
173180
private bindEvent() {
174181
this.$body.on('click', this.c('.icon-close'), this.hide)
175182
this.on('optionChange', this.render)
@@ -212,11 +219,15 @@ export default class Modal extends Component<IOptions> {
212219

213220
let globalModal: Modal | null = null
214221

222+
let globalContainer: HTMLElement | null = null
223+
215224
function getGlobalModal() {
225+
if (!globalContainer) {
226+
globalContainer = h('div')
227+
document.body.append(globalContainer)
228+
}
216229
if (!globalModal) {
217-
const container = h('div')
218-
document.body.append(container)
219-
globalModal = new Modal(container, {
230+
globalModal = new Modal(globalContainer, {
220231
showClose: false,
221232
})
222233
}

Diff for: src/modal/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "modal",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Create modal dialogs",
55
"luna": {
66
"icon": true

Diff for: src/modal/style.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@
7676
}
7777

7878
.button {
79-
padding: 6px 12px;
79+
padding: 0 12px;
8080
background: #e9ecef;
8181
cursor: default;
8282
position: relative;
8383
user-select: none;
8484
margin: 0 4px;
8585
font-size: $font-size-s;
8686
border-radius: 4px;
87+
overflow: hidden;
88+
height: 28px;
89+
line-height: 28px;
8790
&:active {
8891
&::before {
8992
background: $primary-color;
@@ -115,6 +118,8 @@
115118
font-size: 16px;
116119
padding: 6px 12px;
117120
border: 1px solid $border-color;
121+
-webkit-appearance: none;
122+
-moz-appearance: none;
118123
}
119124

120125
.theme-dark {

0 commit comments

Comments
 (0)