@@ -118,10 +118,21 @@ function formatThemeName(themeName: string) {
118118
119119// 设置面板显示状态
120120const showSettings = ref (false )
121+
122+ // Auto-scroll to bottom as content streams in
123+ const messagesContainer = ref <HTMLElement | null >(null )
124+
125+ watch (content , () => {
126+ nextTick (() => {
127+ if (messagesContainer .value ) {
128+ messagesContainer .value .scrollTop = messagesContainer .value .scrollHeight
129+ }
130+ })
131+ })
121132 </script >
122133
123134<template >
124- <div class =" h-screen relative app-container" >
135+ <div class =" h-screen flex items-center justify-center p-4 app-container bg-gray-50 dark:bg-gray-900 " >
125136 <!-- 设置按钮和面板 -->
126137 <div class =" fixed top-4 right-4 z-10" >
127138 <!-- 设置按钮 -->
@@ -265,20 +276,102 @@ const showSettings = ref(false)
265276 </Transition >
266277 </div >
267278
268- <main class =" main-content h-full flex w-full flex-col-reverse overflow-auto" >
269- <MarkdownRender
270- :content =" content"
271- :code-block-dark-theme =" selectedTheme || undefined"
272- :code-block-light-theme =" selectedTheme || undefined"
273- :themes =" themes"
274- :is-dark =" isDark"
275- class =" flex-1 p-8"
276- />
277- </main >
279+ <!-- Chatbot-style container -->
280+ <div class =" chatbot-container max-w-5xl w-full h-[85vh] bg-white dark:bg-gray-800 rounded-2xl shadow-2xl dark:shadow-gray-900/50 flex flex-col overflow-hidden border border-gray-200 dark:border-gray-700" >
281+ <!-- Header -->
282+ <div class =" chatbot-header px-6 py-4 border-b border-gray-200 dark:border-gray-700 bg-gradient-to-r from-blue-50 to-purple-50 dark:from-gray-800 dark:to-gray-800" >
283+ <div class =" flex items-center justify-between gap-3" >
284+ <div class =" flex items-center gap-3" >
285+ <div class =" w-10 h-10 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center shadow-lg" >
286+ <Icon icon =" carbon:chat" class =" w-5 h-5 text-white" />
287+ </div >
288+ <div >
289+ <h1 class =" text-lg font-semibold text-gray-800 dark:text-gray-100" >
290+ Vue Markdown Renderer
291+ </h1 >
292+ <p class =" text-xs text-gray-500 dark:text-gray-400" >
293+ Streaming markdown demo
294+ </p >
295+ </div >
296+ </div >
297+
298+ <!-- GitHub Star Button -->
299+ <a
300+ href =" https://github.com/Simon-He95/vue-markdown-render"
301+ target =" _blank"
302+ rel =" noopener noreferrer"
303+ class ="
304+ github-star-btn flex items-center gap-2 px-3 py-1.5
305+ bg-gray-800 dark:bg-gray-700 hover:bg-gray-700 dark:hover:bg-gray-600
306+ text-white text-sm font-medium rounded-lg
307+ transition-all duration-200
308+ shadow-md hover:shadow-lg
309+ focus:outline-none focus:ring-2 focus:ring-blue-500/50
310+ "
311+ >
312+ <Icon icon =" carbon:star" class =" w-4 h-4" />
313+ <span >Star</span >
314+ </a >
315+ </div >
316+ </div >
317+
318+ <!-- Messages area with scroll -->
319+ <main ref =" messagesContainer" class =" chatbot-messages flex-1 overflow-y-auto" >
320+ <MarkdownRender
321+ :content =" content"
322+ :code-block-dark-theme =" selectedTheme || undefined"
323+ :code-block-light-theme =" selectedTheme || undefined"
324+ :themes =" themes"
325+ :is-dark =" isDark"
326+ class =" p-6"
327+ />
328+ </main >
329+ </div >
278330 </div >
279331</template >
280332
281333<style scoped>
334+ .app-container {
335+ transition : background-color 0.3s ease ;
336+ }
337+
338+ .chatbot-container {
339+ transition : all 0.3s ease ;
340+ }
341+
342+ .github-star-btn :active {
343+ transform : scale (0.95 );
344+ }
345+
346+ .chatbot-messages {
347+ scroll-behavior : smooth ;
348+ }
349+
350+ .chatbot-messages ::-webkit-scrollbar {
351+ width : 8px ;
352+ }
353+
354+ .chatbot-messages ::-webkit-scrollbar-track {
355+ background : transparent ;
356+ }
357+
358+ .chatbot-messages ::-webkit-scrollbar-thumb {
359+ background : #cbd5e1 ;
360+ border-radius : 4px ;
361+ }
362+
363+ .dark .chatbot-messages ::-webkit-scrollbar-thumb {
364+ background : #475569 ;
365+ }
366+
367+ .chatbot-messages ::-webkit-scrollbar-thumb :hover {
368+ background : #94a3b8 ;
369+ }
370+
371+ .dark .chatbot-messages ::-webkit-scrollbar-thumb :hover {
372+ background : #64748b ;
373+ }
374+
282375.settings-toggle {
283376 backdrop-filter : blur (8px );
284377}
0 commit comments