-
Notifications
You must be signed in to change notification settings - Fork 0
試験的 modal dialog component #718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hidetaro7
wants to merge
3
commits into
main
Choose a base branch
from
feat-modal-dialog
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Modal-Dialog | ||
|
|
||
| ## Default | ||
|
|
||
| :::raw | ||
|
|
||
| <dialog id="dialog-1" class="jumpu-modal-dialog jumpu-card fixed top-1/2 left-1/2 -translate-1/2 " onclick="if(event.target !== document.querySelector('.dialog-content')){event.target.close()}"> | ||
| <button onclick="document.querySelector('#dialog-1').close()" class="jumpu-icon-button absolute top-2 right-2">✗</button> | ||
| <div class="pt-10 min-h-64 px-8 py-4 dialog-content"> | ||
| <h2 class="mb-4 font-bold text-lg">モーダル・ダイアログ</h2> | ||
| <p class="my-4">3年ほど前(2022年)になりますが、<a class="underline" href="https://github.com/tuqulore/jumpu-ui/issues/182">Modal Dialogコンポーネントの実装</a>で議論した結果、jumpu UI のコンポーネントとしては実装しないことになりました。ただ、Headless UI 等のフレームワークに依存するまでもなく、ツクロアのボイラープレートでもJSXが利用可能になることなど、当時と状況が変わってきているため、このコンポーネントは試験的に Jumpu UI として実装を試みています。</p> | ||
| <p>このモーダルダイアログの背景はクールです。(<a class="underline" href="https://developer.mozilla.org/ja/docs/Web/HTML/Reference/Elements/dialog">MDNのサイト参照</a>)</p> | ||
| </div> | ||
| </dialog> | ||
|
|
||
| <button onclick="document.querySelector('#dialog-1').showModal()" class="jumpu-button m-40">ダイアログを表示</button> | ||
|
|
||
| ::: | ||
|
|
||
| ```html | ||
| <dialog | ||
| id="dialog-1" | ||
| class="jumpu-modal-dialog jumpu-card -translate-1/2 fixed left-1/2 top-1/2" | ||
| onclick="if(event.target !== document.querySelector('.dialog-content')){event.target.close()}" | ||
| > | ||
| <button | ||
| onclick="document.querySelector('#dialog-1').close()" | ||
| class="jumpu-icon-button absolute right-2 top-2" | ||
| > | ||
| ✗ | ||
| </button> | ||
| <div class="dialog-content min-h-64 px-8 py-4 pt-10"> | ||
| <p>このモーダルダイアログの背景はクールです</p> | ||
| </div> | ||
| </dialog> | ||
|
|
||
| <button | ||
| onclick="document.querySelector('#dialog-1').showModal()" | ||
| class="jumpu-button m-40" | ||
| > | ||
| ダイアログを表示 | ||
| </button> | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| .jumpu-modal-dialog { | ||
| opacity: 0; | ||
| transform: scale(0.95); | ||
| transition: | ||
| opacity 0.4s ease-out, | ||
| transform 0.4s ease-out, | ||
| overlay 0.4s ease-out allow-discrete, | ||
| display 0.4s ease-out allow-discrete; | ||
| } | ||
|
|
||
| @starting-style { | ||
| .jumpu-modal-dialog[open] { | ||
| opacity: 0; | ||
| transform: scaleY(0); | ||
| } | ||
| } | ||
|
|
||
| .jumpu-modal-dialog[open] { | ||
| opacity: 1; | ||
| transform: scale(1); | ||
| } | ||
|
|
||
| .jumpu-modal-dialog::backdrop { | ||
| transition: | ||
| display 0.4s allow-discrete, | ||
| overlay 0.4s allow-discrete, | ||
| background-color 0.4s; | ||
| } | ||
|
|
||
| .jumpu-modal-dialog[open]::backdrop { | ||
| background-color: --alpha(var(--color-gray-950) / 25%); | ||
| } | ||
|
|
||
| @starting-style { | ||
| .jumpu-modal-dialog[open]::backdrop { | ||
| background-color: --alpha(var(--color-gray-950) / 0%); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The close button targets '#dialog-1' but the associated element in this code block (starting on line 21) is missing the corresponding id. Consider adding an id="dialog-1" attribute on the element for proper functionality.