Skip to content

Commit

Permalink
fix(plugin-redirect): fix scrollLock, close #105
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Apr 17, 2024
1 parent de55e4d commit 238e222
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
16 changes: 8 additions & 8 deletions plugins/plugin-redirect/src/client/components/LanguageSwitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
computed,
defineComponent,
h,
onBeforeUnmount,
onMounted,
onUnmounted,
ref,
TransitionGroup,
watch,
Expand Down Expand Up @@ -111,35 +111,35 @@ export default defineComponent({
{ immediate: true },
)

onUnmounted(() => {
onBeforeUnmount(() => {
isLocked.value = false
})
})

return (): VNode | null =>
showModal.value
? h(TransitionGroup, { name: 'lang-modal-fade' }, () =>
? h(TransitionGroup, { name: 'redirect-modal-fade' }, () =>
showModal.value
? h(
'div',
{ key: 'mask', class: 'lang-modal-mask' },
{ key: 'mask', class: 'redirect-modal-mask' },
h(
'div',
{
key: 'popup',
class: 'lang-modal-wrapper',
class: 'redirect-modal-wrapper',
},
[
h(
'div',
{ class: 'lang-modal-content' },
{ class: 'redirect-modal-content' },
locale.value?.hint.map((text) => h('p', text)),
),
h(
'button',
{
type: 'button',
class: 'lang-modal-action primary',
class: 'redirect-modal-action primary',
onClick: () => {
updateStatus()
router.replace(targetRoute.value!)
Expand All @@ -151,7 +151,7 @@ export default defineComponent({
'button',
{
type: 'button',
class: 'lang-modal-action',
class: 'redirect-modal-action',
onClick: () => updateStatus(),
},
locale.value?.cancel,
Expand Down
14 changes: 7 additions & 7 deletions plugins/plugin-redirect/src/client/styles/language-switch.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.lang-modal-fade-enter-active,
.lang-modal-fade-leave-active {
.redirect-modal-fade-enter-active,
.redirect-modal-fade-leave-active {
transition: opacity 0.5s;
}

.lang-modal-fade-enter,
.lang-modal-fade-leave-to {
.redirect-modal-fade-enter,
.redirect-modal-fade-leave-to {
opacity: 0;
}

.lang-modal-mask {
.redirect-modal-mask {
position: fixed;
inset: 0;
z-index: var(--redirect-z-index);
Expand All @@ -24,7 +24,7 @@
}
}

.lang-modal-wrapper {
.redirect-modal-wrapper {
position: relative;
z-index: 1500;

Expand All @@ -38,7 +38,7 @@
box-shadow: 0 2px 6px 0 var(--card-shadow);
}

.lang-modal-action {
.redirect-modal-action {
display: block;

width: 100%;
Expand Down
2 changes: 0 additions & 2 deletions plugins/plugin-redirect/src/node/getRedirectLocaleConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export const getRedirectLocaleConfig = (
fromEntries(
entries(locales)
.filter(([key, { lang }]) => {
if (key === '/') return false

if (!lang) {
logger.error(
`Missing ${colors.magenta(
Expand Down
2 changes: 1 addition & 1 deletion themes/theme-default/src/client/styles/vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ body {
}

// plugin-redirect
.language-modal-mask {
.redirect-modal-mask {
--redirect-bg-color: var(--c-bg);
--redirect-bg-color-light: var(--c-bg-light);
--redirect-bg-color-lighter: var(--c-bg-lighter);
Expand Down

0 comments on commit 238e222

Please sign in to comment.