-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Increase Stake Modal #13
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
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
91960f6
feat: add Increase Stake Modal
sul-igr d2fc2db
fix: fixed tsc issues
sul-igr ef43124
merged with add-voting-positions-table
sul-igr 3086311
fix: updated logic and fixed issues from PR
sul-igr 2808575
Merge branch 'master' into increase-stake
sul-igr 7a98f53
added latest yarn.lock
sul-igr 6481fc5
fix: update yarn.lock
microHoffman bf88d34
fix: type error on wagmi config
microHoffman 7b89aa3
Updates from PR
sul-igr f32c1b1
fix: fix build
sul-igr ac29503
fix: show voting positions
sul-igr 5bd61ff
fix: fixed remaining stuff from PR + added pinia and vue tanstack dev…
sul-igr 7f7e391
feat: format numbers
sul-igr 3b95b41
fix: update yarn.lock
sul-igr 20d16ce
fix: update lockfile
sul-igr 003ef69
fix: voting positions now filters correctly and sorting works again
sul-igr 2a95066
fix: fixes from PR
sul-igr 3640a53
refactor: change where we get the PwnWagmiConfig type from
microHoffman ada1f14
fix: fixes from PR and added checkbox
sul-igr 437044d
fix: add voting power note
sul-igr 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,319 @@ | ||
<template> | ||
<slot name="trigger"/> | ||
<teleport to="body"> | ||
<Transition | ||
type="transition" | ||
name="modal-show"> | ||
<aside | ||
v-if="isOpenLocal" | ||
:class="['modal', {'modal--blur-backdrop': hasBlurBackdrop}]" | ||
:style="wrapperDynamicStyles" | ||
@mousedown="close"> | ||
<div | ||
:class="['modal__content', `modal__content--size-large`, `${props.className}`]" | ||
:style="contentCustomStyles"> | ||
<slot name="customHeader"> | ||
<header> | ||
<div class="modal__heading-container"> | ||
<h2 | ||
:class="['modal__heading', `modal__heading--align-${props.headingAlign}`]" | ||
:style="props.customHeadingStyles"> | ||
<div> | ||
<component | ||
:is="props.headingIcon" | ||
v-if="props.headingIcon" | ||
:class="['modal__heading-icon']" | ||
alt="modal heading icon"/> | ||
</div> | ||
{{ props.heading }} | ||
</h2> | ||
<svg | ||
v-if="props.isClosable" | ||
:class="['modal__close']" | ||
width="25" | ||
height="25" | ||
viewBox="0 0 25 25" | ||
@click.stop="close"> | ||
<line | ||
x1="2.06066" | ||
y1="1.93934" | ||
x2="23.2739" | ||
y2="23.1525" | ||
stroke="currentColor" | ||
stroke-width="3" | ||
@click.stop="close"/> | ||
<line | ||
x1="1.93934" | ||
y1="23.1542" | ||
x2="23.1525" | ||
y2="1.94098" | ||
stroke="currentColor" | ||
stroke-width="3" | ||
@click.stop="close"/> | ||
</svg> | ||
</div> | ||
<div class="modal__subheading-container"> | ||
<slot name="subheading"/> | ||
</div> | ||
</header> | ||
</slot> | ||
<section class="modal__body"> | ||
<slot name="body"/> | ||
</section> | ||
</div> | ||
</aside> | ||
</Transition> | ||
</teleport> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed, watch } from 'vue' | ||
import type { Component, StyleValue } from 'vue' | ||
import { useMagicKeys } from '@vueuse/core' | ||
|
||
interface Props { | ||
isOpen: boolean; | ||
heading?: string; | ||
isClosable?: boolean; | ||
headingIcon?: Component | ||
headingAlign?: 'center' | 'left' | ||
customZIndex?: number; | ||
customMaxWidth?: string; | ||
customPadding?: string; | ||
customHeadingStyles?: StyleValue | ||
hasBlurBackdrop?: boolean; | ||
className?: string | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
isClosable: true, | ||
headingAlign: 'center', | ||
customHeadingStyles: () => ({}), | ||
}) | ||
|
||
const emit = defineEmits<{(e: 'update:isOpen', isOpen: boolean): any, (e: 'is-closed', isOpen: boolean): any }>() | ||
|
||
defineSlots<{ | ||
// slots return "any" atm as described in official docs | ||
trigger(): unknown; | ||
customHeader(): unknown; | ||
subheading(): unknown; | ||
body(): unknown; | ||
}>() | ||
|
||
const wrapperDynamicStyles = computed(() => { | ||
return { | ||
...(props.customZIndex && { zIndex: props.customZIndex }), | ||
} | ||
}) | ||
|
||
const contentCustomStyles = computed(() => { | ||
return { | ||
...(props.customMaxWidth && { maxWidth: props.customMaxWidth }), | ||
...(props.customPadding && { padding: props.customPadding }), | ||
} | ||
}) | ||
|
||
const isOpenLocal = computed({ | ||
get: (): boolean => props.isOpen, | ||
set: (value: boolean): void => emit('update:isOpen', value), | ||
}) | ||
|
||
const isClickedOutside = (event: any): boolean => event.target !== event.currentTarget | ||
|
||
const close = (event: MouseEvent): void => { | ||
if (!props.isClosable) return | ||
if (isClickedOutside(event)) return | ||
isOpenLocal.value = false | ||
emit('is-closed', true) | ||
} | ||
const { escape } = useMagicKeys() | ||
|
||
watch(escape, (v) => { | ||
if (v) { | ||
isOpenLocal.value = false | ||
} | ||
}) | ||
|
||
watch(isOpenLocal, () => { | ||
if (isOpenLocal.value) { | ||
document.body.style.overflow = 'hidden' | ||
} else { | ||
document.body.style.overflow = 'auto' | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.modal { | ||
position: fixed; | ||
inset: 0; | ||
|
||
isolation: isolate; | ||
z-index: var(--z-index-modal); | ||
|
||
display: grid; | ||
place-items: center; | ||
|
||
background: var(--background-color-half-transparent); | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
|
||
&--blur-backdrop { | ||
backdrop-filter: blur(2px); | ||
} | ||
|
||
&__body { | ||
display: flex; | ||
flex-flow: column nowrap; | ||
gap: 1.5rem; | ||
align-items: flex-start; | ||
} | ||
|
||
&__content { | ||
max-height: 100%; | ||
overflow: auto; | ||
position: relative; | ||
|
||
background: var(--background-color); | ||
border: 1px solid #434343; | ||
|
||
display: flex; | ||
flex-flow: column nowrap; | ||
gap: 1.5rem; | ||
|
||
padding: 1.5rem; | ||
|
||
@media only screen and (--mobile-viewport) { | ||
padding: 1.5rem 0.5rem; | ||
} | ||
|
||
&:hover { | ||
cursor: default; | ||
} | ||
|
||
&--variant { | ||
&-error { | ||
border: 1px solid #434343; | ||
} | ||
} | ||
} | ||
|
||
&__heading-container { | ||
display: grid; | ||
grid-template-columns: 1fr auto 1fr; | ||
align-items: center; | ||
} | ||
|
||
&__heading { | ||
font-family: var(--font-family-screener); | ||
display: flex; | ||
|
||
font-size: 1.5rem; | ||
font-weight: 400; | ||
|
||
&--align { | ||
&-center { | ||
grid-column-start: 2; | ||
} | ||
|
||
&-left { | ||
/* allow the heading text to take full width */ | ||
grid-column: 1 / 4; | ||
justify-self: start; | ||
} | ||
} | ||
|
||
&--variant { | ||
&-error { | ||
color: var(--negative-1); | ||
} | ||
} | ||
} | ||
|
||
&__heading-icon { | ||
width: 2rem; | ||
|
||
&--large { | ||
width: 6rem; | ||
} | ||
|
||
&--medium { | ||
width: 1.125rem; | ||
height: 1.125rem; | ||
} | ||
} | ||
|
||
&__close { | ||
grid-column: 4; | ||
justify-self: end; | ||
margin-left: 0.75rem; | ||
color: var(--text-color); | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
|
||
&--variant { | ||
&-error { | ||
color: var(--negative-1); | ||
} | ||
} | ||
} | ||
|
||
@media only screen and (--small-viewport) { | ||
&__content { | ||
&--size { | ||
&-medium { | ||
width: calc(100% * var(--modal-size-medium-mobile)); | ||
max-width: calc(var(--app-max-width) * var(--modal-size-medium-mobile)); | ||
} | ||
|
||
&-small { | ||
width: 100%; | ||
max-width: fit-content; | ||
} | ||
|
||
&-large { | ||
width: calc(100% * var(--modal-size-small-mobile)); | ||
max-width: calc(var(--app-max-width) * var(--modal-size-large-mobile)); | ||
} | ||
} | ||
} | ||
|
||
&__heading { | ||
line-height: 1rem; | ||
} | ||
|
||
&__close { | ||
width: 1rem; | ||
height: 1rem; | ||
} | ||
} | ||
} | ||
|
||
.modal-show { | ||
&-enter-active, | ||
&-leave-active { | ||
transition: opacity 0.3s; | ||
} | ||
|
||
&-enter-from, | ||
&-leave-to { | ||
opacity: 0; | ||
} | ||
|
||
&-enter-to, | ||
&-leave-from { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
</style> | ||
|
||
<style> | ||
.nouns-subdomain .modal__content { | ||
background-blend-mode: exclusion; | ||
} | ||
</style> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.