Skip to content

Commit

Permalink
feat(code frame): prevent overscroll; cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Nov 24, 2023
1 parent a0027e1 commit 99f51e6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .vitepress/theme/style.sass
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ html
.name
font-weight: 800

.VPImage
border-radius: 10px

.header-anchor
min-width: 0.87em

Expand Down
43 changes: 21 additions & 22 deletions components/CodeFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ const zoomed = ref(false);
aria-label="Zoom"
@click="zoomed = zoomed !== true"
>
<div />
<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
<path
d="M288 928h-96c-52.8 0-96-43.2-96-96v-96c0-17.6 14.4-32 32-32s32 14.4 32 32v96c0 17.6 14.4 32 32 32h96c17.6 0 32 14.4 32 32s-14.4 32-32 32z m544 0h-96c-17.6 0-32-14.4-32-32s14.4-32 32-32h96c17.6 0 32-14.4 32-32v-96c0-17.6 14.4-32 32-32s32 14.4 32 32v96c0 52.8-43.2 96-96 96z m64-608c-17.6 0-32-14.4-32-32v-96c0-17.6-14.4-32-32-32h-96c-17.6 0-32-14.4-32-32s14.4-32 32-32h96c52.8 0 96 43.2 96 96v96c0 17.6-14.4 32-32 32z m-768 0c-17.6 0-32-14.4-32-32v-96c0-52.8 43.2-96 96-96h96c17.6 0 32 14.4 32 32s-14.4 32-32 32h-96c-17.6 0-32 14.4-32 32v96c0 17.6-14.4 32-32 32z m544 448H352c-52.8 0-96-43.2-96-96V352c0-52.8 43.2-96 96-96h320c52.8 0 96 43.2 96 96v320c0 52.8-43.2 96-96 96zM352 320c-17.6 0-32 14.4-32 32v320c0 17.6 14.4 32 32 32h320c17.6 0 32-14.4 32-32V352c0-17.6-14.4-32-32-32H352z"
fill="currentColor"
/>
</svg>
</button>
</div>
</div>
</template>

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Dk2IDQzLjIgOTYgOTZ2MzIwYzAgNTIuOC00My4yIDk2LTk2IDk2ek0zNTIgMzIwYy0xNy42IDAtMzIgMTQuNC0zMiAzMnYzMjBjMCAxNy42IDE0LjQgMzIgMzIgMzJoMzIwYzE3LjYgMCAzMi0xNC40IDMyLTMyVjM1MmMwLTE3LjYtMTQuNC0zMi0zMi0zMkgzNTJ6Ii8+Cjwvc3ZnPgo=')
</style>

<style lang="sass" scoped>
.vp-quasar-repl
display: flex
Expand All @@ -62,9 +62,10 @@ const zoomed = ref(false);
position: relative
flex: 1 1 auto
margin-inline: -24px
overflow: auto
overscroll-behavior: contain
iframe
overflow: auto
width: 100%
height: 100%
outline: none
Expand All @@ -88,47 +89,45 @@ const zoomed = ref(false);
margin-inline: -256px -512px
.vp-quasar-repl__zoom
display: none
position: absolute
padding: 0
width: 32px
height: 32px
inset: auto 4px 4px auto
border-radius: 4px
border: 1px solif var(--vp-button-alt-border)
background-color: var(--vp-button-alt-bg)
z-index: var(--vp-z-index-sidebar)
background-color: var(--vp-button-alt-bg)
color: var(--vp-button-alt-text)
@media (min-width: 1280px)
display: block
> div
> svg
position: absolute
inset: 2px
mask: var(--vp-icon-zoom) no-repeat 100% 100%
mask-size: cover
background-color: var(--vp-button-alt-text)
pointer-events: none
&:hover
border: 1px solif var(--vp-button-alt-hover-border)
color: var(--vp-button-alt-hover-text)
background-color: var(--vp-button-alt-hover-bg)
> div
background-color: var(--vp-button-alt-hover-text)
&:active
border: 1px solif var(--vp-button-alt-active-border)
color: var(--vp-button-alt-active-text)
background-color: var(--vp-button-alt-active-bg)
> div
background-color: var(--vp-button-alt-active-text)
&--active
color: var(--vp-button-brand-text)
background-color: var(--vp-button-brand-bg)
> div
background-color: var(--vp-button-brand-text)
&:hover
color: var(--vp-button-brand-hover-text)
background-color: var(--vp-button-brand-hover-bg)
> div
background-color: var(--vp-button-brand-hover-text)
&:active
color: var(--vp-button-brand-active-text)
background-color: var(--vp-button-brand-active-bg)
> div
background-color: var(--vp-button-brand-active-text)
</style>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"scripts": {
"dev": "vitepress dev",
"dev": "vitepress dev --host",
"build": "vitepress build",
"preview": "vitepress preview",
"lint": "eslint --ext .js,.vue,.md ./"
Expand Down
Binary file modified public/logo2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 99f51e6

Please sign in to comment.