Skip to content

Commit

Permalink
fix: mobile code block (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrtsky authored Jun 1, 2021
1 parent 1c7b622 commit b190592
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/defaultTheme/components/atoms/CodeGroup.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<template>
<div class="code-group" :class="[activeTabIndex == 0 && 'first-tab']">
<div class="relative px-3.5 text-sm text-white bg-gray-100 rounded-t-lg dark:bg-gray-800">
<div class="relative px-2 text-white bg-gray-100 rounded-t-lg dark:bg-gray-800">
<button
v-for="({ label }, i) in tabs"
ref="tabs"
:key="`${counter}${label}`"
class="relative z-10 px-3 py-4 font-mono font-semibold"
class="relative z-10 px-3 py-1.5 xs:py-3 my-1.5 xs:my-0 text-sm font-mono font-semibold tracking-tight"
:class="[activeTabIndex === i ? 'active text-gray-800 dark:text-white' : 'text-gray-600 dark:text-gray-300']"
@click="updateTabs(i)"
>
{{ label }}
</button>
<span ref="highlight-underline" class="absolute z-0 highlight-underline h-full py-2">
<span ref="highlight-underline" class="absolute z-0 highlight-underline h-full xs:py-1.5">
<span class="flex w-full h-full bg-gray-200 dark:bg-gray-700 rounded-md"></span>
</span>
</div>
Expand Down Expand Up @@ -83,7 +83,9 @@ export default defineComponent({
}
const highlightUnderline = this.$refs['highlight-underline']
highlightUnderline.style.left = `${activeTab.offsetLeft}px`
highlightUnderline.style.top = `${activeTab.offsetTop}px`
highlightUnderline.style.width = `${activeTab.clientWidth}px`
highlightUnderline.style.height = `${activeTab.clientHeight}px`
},
calculateTabs() {
const components = this.$slots.default
Expand Down Expand Up @@ -139,7 +141,7 @@ button {
.highlight-underline {
/* bottom: -2px; */
/* height: 2px; */
transition: left 150ms, width 150ms;
transition: left 150ms, top 150ms, width 150ms, height 150ms;
}
.code-group ::v-deep {
Expand Down

1 comment on commit b190592

@vercel
Copy link

@vercel vercel bot commented on b190592 Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.