Skip to content

Commit

Permalink
modal: styles built in
Browse files Browse the repository at this point in the history
  • Loading branch information
zraly committed Jun 13, 2022
1 parent 00e4f09 commit 36a227c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions components/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ export default () => ({
originalBodyPaddingRight: null,
originalBodyOverflow: null,
style: {
background: "fixed top-0 left-0 flex w-screen h-screen max-w-full bg-neutral-500/50 z-50 overflow-y-auto",
dialog: "h-auto p-6 m-auto relative w-full max-w-md bg-white rounded-lg shadow-xl m-3",
background: "fixed top-0 left-0 flex w-screen h-screen max-w-full bg-neutral-500/50 z-50 overflow-y-auto p-3",
dialog: "h-auto p-6 m-auto relative w-full max-w-md bg-white rounded-lg shadow-xl",
},
init() {
const style = this.style;
const backgroundElement = this.$el.querySelector("[x-bind=background]");
const dialogElement = this.$el.querySelector("[x-bind=dialog]");
const templateContent = this.$el.querySelector("template").content;
const backgroundElement = templateContent.querySelector("[x-bind=background]");
const dialogElement = templateContent.querySelector("[x-bind=dialog]");
backgroundElement.className = style.background;
dialogElement.className = style.dialog;

Expand All @@ -31,12 +32,12 @@ export default () => ({
}
})
},
modalTrigger: {
trigger: {
['@click']() {
this.open = ! this.open
},
},
modalBackground: {
background: {
['x-show']() {
return this.open
},
Expand All @@ -59,7 +60,7 @@ export default () => ({
return 'opacity-0';
}
},
modalDialog: {
dialog: {
['x-show']() {
return this.open
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mistral-ui",
"version": "1.2.22-beta.0",
"version": "1.2.23",
"description": "Tailwind CSS + Alpine.js components",
"homepage": "https://mistralui.com",
"main": "index.js",
Expand Down

0 comments on commit 36a227c

Please sign in to comment.