-
Notifications
You must be signed in to change notification settings - Fork 237
Feat/app dialog #650
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
Merged
Merged
Feat/app dialog #650
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e74ec74
feat: app dialog
olgakup 4f6846f
devop: select assets use dialog
olgakup d53ae8e
devop: update select fee to use app dialog
olgakup a1e9007
devop: update network select to use dialog
olgakup 3211917
devop: fix padding in deposit screen
olgakup 17e7045
devop: fix padding in nft detail screen
olgakup 05e3ea3
devop: update network assets to use dialog
olgakup 0c4744d
fix: icons squeeshing
olgakup cd40ec1
chore: add comments
olgakup 8cb681a
fix: warning
olgakup 1e9d84d
chore: remove comments
olgakup 3f3f908
devop: fix store
olgakup 8d588c8
fix: warnings
kvhnuke 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
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 |
|---|---|---|
|
|
@@ -75,6 +75,7 @@ const balance = computed(() => | |
| img { | ||
| width: 100%; | ||
| height: 100%; | ||
| object-fit: contain; | ||
| } | ||
| } | ||
|
|
||
|
|
||
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
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
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
203 changes: 203 additions & 0 deletions
203
packages/extension/src/ui/action/components/app-dialog/index.vue
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,203 @@ | ||
| <template> | ||
| <teleport to="#app"> | ||
| <Transition name="modaltransition"> | ||
| <div v-if="model" :class="[defaultClass, { show: model }]"> | ||
| <div class="app-dialog__overlay" @click="closeDialog" /> | ||
| <div | ||
| class="app-dialog__wrap" | ||
| :class="[{ show: model }]" | ||
| :style="dialogStyle" | ||
| > | ||
| <a class="app-dialog__close" @click="closeDialog"> | ||
| <close-icon /> | ||
| </a> | ||
|
|
||
| <slot /> | ||
| </div> | ||
| </div> | ||
| </Transition> | ||
| </teleport> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import CloseIcon from '@action/icons/common/close-icon.vue'; | ||
| import { useMenuStore } from '@action/store/menu-store'; | ||
| import { storeToRefs } from 'pinia'; | ||
| import { computed } from 'vue'; | ||
|
|
||
| /** | ||
| * This component is a dialog that can be used to display content in a modal. | ||
| * It has a close button and a backdrop that can be clicked to close the dialog. | ||
| * The dialog can be centered or not centered. | ||
| * By default, it aligned to cover the right side of the screen and be the max width of the content that does not cover menu. | ||
| * | ||
| * !!! Do not use it if pinia store is not defined, as it depends on the menu store. | ||
| * | ||
| * @emits close:dialog - Emits when the dialog is closed. | ||
| * @model - Controls the visibility of the dialog. | ||
| * | ||
| * @example Basic Dialog | ||
| * <app-dialog v-model="dialogModel"> | ||
| * <div> hello world </div> | ||
| * </app-dialog> | ||
| * @example Centered Dialog with custom width | ||
| * | ||
| * <app-dialog v-model="dialogModel" width="500px" isCentered> | ||
| * <div> hello world </div> | ||
| * </app-dialog> | ||
| * | ||
| */ | ||
| const props = defineProps({ | ||
| width: { | ||
| type: String, | ||
| default: '428px', | ||
| }, | ||
| isCentered: { | ||
| type: Boolean, | ||
| default: false, | ||
| }, | ||
| }); | ||
| /** ------------------- | ||
| * Open Close State | ||
| -------------------*/ | ||
| const emit = defineEmits<{ | ||
| (e: 'close:dialog'): void; | ||
| }>(); | ||
|
|
||
| const model = defineModel<boolean>(); | ||
|
|
||
| const closeDialog = () => { | ||
| model.value = false; | ||
| emit('close:dialog'); | ||
| }; | ||
|
|
||
| /** ------------------- | ||
| * Styling | ||
| -------------------*/ | ||
| const menuStore = useMenuStore(); | ||
| const { isExpanded } = storeToRefs(menuStore); | ||
| const defaultClass = computed(() => { | ||
| const widthClass = isExpanded.value ? 'expanded' : 'collapsed'; | ||
| const justifyClass = props.isCentered ? 'is-centered' : 'is-not-centered'; | ||
| return `app-dialog app-dialog__${widthClass} app-dialog__${justifyClass}`; | ||
| }); | ||
|
|
||
| const dialogStyle = computed(() => { | ||
| return { | ||
| width: props.width, | ||
| }; | ||
| }); | ||
| </script> | ||
|
|
||
| <style lang="less" scoped> | ||
| @import '@action/styles/theme.less'; | ||
|
|
||
| .app-dialog { | ||
| height: 600px; | ||
| top: 0px; | ||
| position: fixed; | ||
| z-index: 105; | ||
| display: none; | ||
| box-sizing: border-box; | ||
| align-items: center; | ||
| flex-direction: row; | ||
| padding: 16px; | ||
| transition: opacity 0.3s ease; | ||
|
|
||
| &__expanded { | ||
| width: 800px; | ||
| } | ||
| &__collapsed { | ||
| width: 516px; | ||
| } | ||
| &__is-centered { | ||
| justify-content: center; | ||
| } | ||
| &__is-not-centered { | ||
| justify-content: end; | ||
| } | ||
|
|
||
| &.show { | ||
| display: flex; | ||
| } | ||
|
|
||
| &__overlay { | ||
| background: rgba(0, 0, 0, 0.32); | ||
| width: 100%; | ||
| height: 100%; | ||
| left: 0px; | ||
| top: 0px; | ||
| position: absolute; | ||
| z-index: 106; | ||
| } | ||
|
|
||
| &__wrap { | ||
| background: @white; | ||
| box-shadow: | ||
| 0px 0.5px 5px rgba(0, 0, 0, 0.039), | ||
| 0px 3.75px 11px rgba(0, 0, 0, 0.19); | ||
| border-radius: 12px; | ||
| position: relative; | ||
| z-index: 107; | ||
| overflow-y: scroll; | ||
| max-height: 100%; | ||
| box-sizing: border-box; | ||
| opacity: 0; | ||
| visibility: hidden; | ||
| transition: all 0.3s ease; | ||
|
|
||
| &.show { | ||
| opacity: 1; | ||
| visibility: visible; | ||
| transition-delay: 0s; | ||
| } | ||
|
|
||
| h2 { | ||
| font-style: normal; | ||
| font-weight: 700; | ||
| font-size: 20px; | ||
| line-height: 28px; | ||
| letter-spacing: 0.15px; | ||
| color: @primaryLabel; | ||
| margin: 0; | ||
| } | ||
|
|
||
| p { | ||
| font-style: normal; | ||
| font-weight: 400; | ||
| font-size: 14px; | ||
| line-height: 20px; | ||
| letter-spacing: 0.25px; | ||
| color: @primaryLabel; | ||
| margin: 0 0 24px 0; | ||
| } | ||
| } | ||
|
|
||
| &__close { | ||
| position: absolute; | ||
| top: 8px; | ||
| right: 8px; | ||
| border-radius: 8px; | ||
| cursor: pointer; | ||
| font-size: 0; | ||
| transition: background 300ms ease-in-out; | ||
| z-index: 108; | ||
| &:hover { | ||
| background: @black007; | ||
| } | ||
| } | ||
| } | ||
| .modaltransition-enter-from { | ||
| opacity: 0; | ||
| } | ||
|
|
||
| .modaltransition-leave-to { | ||
| opacity: 0; | ||
| } | ||
|
|
||
| .modaltransition-enter-from .app-dialog__wrap, | ||
| .modaltransition-leave-to .app-dialog__wrap { | ||
| -webkit-transform: scale(1.1); | ||
| transform: scale(1.1); | ||
| } | ||
| </style> |
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
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.
Warning: Incorrect class assignment for bottom-right positioning.
There appears to be a mismatch in the class naming. When checking for
props.isBottomRight, it's returning a class named'left-bottom'which doesn't match the semantic meaning.📝 Committable suggestion