Skip to content

Commit

Permalink
fix: 修复样式问题[#123][#126]
Browse files Browse the repository at this point in the history
  • Loading branch information
Chanzhaoyu committed Feb 25, 2023
1 parent ae97d3f commit fe55650
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
19 changes: 11 additions & 8 deletions src/views/chat/components/Message/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@
import { computed } from 'vue'
import { marked } from 'marked'
import hljs from 'highlight.js'
import { useBasicLayout } from '@/hooks/useBasicLayout'
interface Props {
inversion?: boolean
error?: boolean
text?: string
loading?: boolean
}
const props = defineProps<Props>()
const { isMobile } = useBasicLayout()
marked.setOptions({
renderer: new marked.Renderer(),
highlight(code) {
return hljs.highlightAuto(code).value
},
})
interface Props {
inversion?: boolean
error?: boolean
text?: string
loading?: boolean
}
const wrapClass = computed(() => {
return [
'text-wrap',
'p-3',
'min-w-[20px]',
'rounded-md',
isMobile.value ? 'p-2' : 'p-4',
props.inversion ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]',
props.inversion ? 'dark:bg-[#a1dc95]' : 'dark:bg-[#1e1e20]',
{ 'text-red-500': props.error },
Expand Down
11 changes: 5 additions & 6 deletions src/views/chat/components/Message/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ interface Props {
interface Emit {
(ev: 'regenerate'): void
(ev: 'copy'): void
(ev: 'delete'): void
}
Expand All @@ -33,15 +32,15 @@ function handleRegenerate() {
<template>
<div class="flex w-full mb-6 overflow-hidden" :class="[{ 'flex-row-reverse': inversion }]">
<div
class="flex items-center justify-center rounded-full overflow-hidden flex-shrink-0 w-[32px] h-[32px]"
:class="[inversion ? 'ml-3' : 'mr-3']"
class="flex items-center justify-center flex-shrink-0 h-8 overflow-hidden rounded-full basis-8"
:class="[inversion ? 'ml-2' : 'mr-2']"
>
<AvatarComponent :image="inversion" />
</div>
<div class="flex flex-col flex-1 text-sm" :class="[inversion ? 'items-end' : 'items-start']">
<span class="text-xs text-[#b4bbc4]">
<div class="overflow-hidden text-sm " :class="[inversion ? 'items-end' : 'items-start']">
<p class="text-xs text-[#b4bbc4]" :class="[inversion ? 'text-right' : 'text-left']">
{{ dateTime }}
</span>
</p>
<div
class="flex items-end gap-2 mt-2"
:class="[inversion ? 'flex-row-reverse' : 'flex-row']"
Expand Down
2 changes: 1 addition & 1 deletion src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ onUnmounted(() => {
<template>
<div class="flex flex-col h-full" :class="wrapClass">
<main class="flex-1 overflow-hidden">
<div ref="scrollRef" class="h-full p-4 overflow-hidden overflow-y-auto" :class="[{ 'p-2': isMobile }]">
<div ref="scrollRef" class="h-full overflow-hidden overflow-y-auto" :class="[isMobile ? 'p-2' : 'p-4']">
<template v-if="!dataSources.length">
<div class="flex items-center justify-center mt-4 text-center text-neutral-300">
<SvgIcon icon="ri:bubble-chart-fill" class="mr-2 text-3xl" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/chat/layout/header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function handleUpdateCollapsed() {
</script>

<template>
<header class="fixed top-0 left-0 right-0 z-30 border-b dark:border-neutral-800 bg-white/80 dark:bg-black/30 backdrop-blur">
<header class="fixed top-0 left-0 right-0 z-30 border-b dark:border-neutral-800 bg-white/80 dark:bg-black/20 backdrop-blur">
<div class="relative flex items-center justify-between h-14">
<button class="flex items-center justify-center w-11 h-11" @click="handleUpdateCollapsed">
<SvgIcon v-if="collapsed" class="text-2xl" icon="ri:align-justify" />
Expand Down

0 comments on commit fe55650

Please sign in to comment.