Skip to content

Commit

Permalink
style: 优化移动端代码展示 (Chanzhaoyu#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
symant233 committed Jun 19, 2023
1 parent 6e272bb commit 847a2d4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/views/chat/components/Header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
interface Emit {
(ev: 'export'): void
(ev: 'toggleUsingContext'): void
(ev: 'handleClear'): void
}
defineProps<Props>()
Expand All @@ -36,8 +36,8 @@ function handleExport() {
emit('export')
}
function toggleUsingContext() {
emit('toggleUsingContext')
function handleClear() {
emit('handleClear')
}
</script>

Expand All @@ -62,16 +62,16 @@ function toggleUsingContext() {
{{ currentChatHistory?.title ?? '' }}
</h1>
<div class="flex items-center space-x-2">
<HoverButton @click="toggleUsingContext">
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
<SvgIcon icon="ri:chat-history-line" />
</span>
</HoverButton>
<HoverButton @click="handleExport">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:download-2-line" />
</span>
</HoverButton>
<HoverButton @click="handleClear">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:delete-bin-line" />
</span>
</HoverButton>
</div>
</div>
</header>
Expand Down
9 changes: 9 additions & 0 deletions src/views/chat/components/Message/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,12 @@ html.dark {
background-color: #282c34;
}
}

@media screen and (max-width: 533px) {
.markdown-body .code-block-wrapper {
padding: unset;
code {
padding: 24px 16px 16px 16px;
}
}
}
6 changes: 3 additions & 3 deletions src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ onUnmounted(() => {
v-if="isMobile"
:using-context="usingContext"
@export="handleExport"
@toggle-using-context="toggleUsingContext"
@handle-clear="handleClear"
/>
<main class="flex-1 overflow-hidden">
<div id="scrollRef" ref="scrollRef" class="h-full overflow-hidden overflow-y-auto">
Expand Down Expand Up @@ -513,7 +513,7 @@ onUnmounted(() => {
<footer :class="footerClass">
<div class="w-full max-w-screen-xl m-auto">
<div class="flex items-center justify-between space-x-2">
<HoverButton @click="handleClear">
<HoverButton v-if="!isMobile" @click="handleClear">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:delete-bin-line" />
</span>
Expand All @@ -523,7 +523,7 @@ onUnmounted(() => {
<SvgIcon icon="ri:download-2-line" />
</span>
</HoverButton>
<HoverButton v-if="!isMobile" @click="toggleUsingContext">
<HoverButton @click="toggleUsingContext">
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
<SvgIcon icon="ri:chat-history-line" />
</span>
Expand Down

0 comments on commit 847a2d4

Please sign in to comment.