Compare commits

..

4 Commits

Author SHA1 Message Date
dribble-njr
a2b19187a9 style: refine border and footer layout 2025-01-09 22:15:50 +08:00
dribble-njr
8041617ea1 style: improve transition effects for PostSlider and RightSlider by a hack way 2025-01-09 21:42:20 +08:00
dribble-njr
f11c31cd96 style: enhance layout and border styling in CodemirrorEditor.vue 2025-01-09 21:12:42 +08:00
dribble-njr
eb64576ab6 style: adjust layout 2025-01-09 19:00:57 +08:00
4 changed files with 38 additions and 31 deletions

View File

@ -8,7 +8,7 @@ import {
} from '@/config' } from '@/config'
import { useStore } from '@/stores' import { useStore } from '@/stores'
import { addPrefix, processClipboardContent } from '@/utils' import { addPrefix, processClipboardContent } from '@/utils'
import { ChevronDownIcon, PanelRightClose, PanelRightOpen } from 'lucide-vue-next' import { ChevronDownIcon, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen } from 'lucide-vue-next'
const emit = defineEmits([`addFormat`, `formatContent`, `startCopy`, `endCopy`]) const emit = defineEmits([`addFormat`, `formatContent`, `startCopy`, `endCopy`])
@ -47,7 +47,7 @@ const formatItems = [
const store = useStore() const store = useStore()
const { isDark, isCiteStatus, isCountStatus, output, primaryColor } = storeToRefs(store) const { isDark, isCiteStatus, isCountStatus, output, primaryColor, isOpenPostSlider } = storeToRefs(store)
const { toggleDark, editorRefresh, citeStatusChanged, countStatusChanged } = store const { toggleDark, editorRefresh, citeStatusChanged, countStatusChanged } = store
@ -102,7 +102,7 @@ function copy() {
</script> </script>
<template> <template>
<header class="header-container h-15 flex items-center justify-between border-b px-5"> <header class="header-container h-15 flex items-center justify-between px-5">
<div class="space-x-2 flex"> <div class="space-x-2 flex">
<Menubar class="menubar"> <Menubar class="menubar">
<FileDropdown /> <FileDropdown />
@ -141,6 +141,20 @@ function copy() {
</div> </div>
<div class="space-x-2 flex"> <div class="space-x-2 flex">
<TooltipProvider :delay-duration="200">
<Tooltip>
<TooltipTrigger as-child>
<Button variant="outline" @click="isOpenPostSlider = !isOpenPostSlider">
<PanelLeftOpen v-show="!isOpenPostSlider" class="size-4" />
<PanelLeftClose v-show="isOpenPostSlider" class="size-4" />
</Button>
</TooltipTrigger>
<TooltipContent side="left">
{{ isOpenPostSlider ? "关闭" : "展开" }}
</TooltipContent>
</Tooltip>
</TooltipProvider>
<div class="space-x-1 bg-background text-background-foreground mx-2 flex items-center border rounded-md"> <div class="space-x-1 bg-background text-background-foreground mx-2 flex items-center border rounded-md">
<Button variant="ghost" class="shadow-none" @click="copy"> <Button variant="ghost" class="shadow-none" @click="copy">
复制 复制

View File

@ -57,13 +57,19 @@ function delPost() {
<template> <template>
<div <div
class="overflow-hidden bg-gray/20 transition-width dark:bg-gray/40" class="overflow-hidden bg-gray/20 transition-width duration-300 dark:bg-gray/40"
:class="{ :class="{
'w-0': !store.isOpenPostSlider, 'w-0': !store.isOpenPostSlider,
'w-50': store.isOpenPostSlider, 'w-50': store.isOpenPostSlider,
}" }"
> >
<nav class="space-y-1 h-full overflow-auto p-2"> <nav
class="space-y-1 h-full overflow-auto p-2 transition-transform"
:class="{
'translate-x-100': store.isOpenPostSlider,
'-translate-x-full': !store.isOpenPostSlider,
}"
>
<Dialog v-model:open="isOpen"> <Dialog v-model:open="isOpen">
<DialogTrigger as-child> <DialogTrigger as-child>
<Button variant="outline" class="w-full" size="xs"> <Button variant="outline" class="w-full" size="xs">
@ -86,10 +92,7 @@ function delPost() {
</DialogContent> </DialogContent>
</Dialog> </Dialog>
<a <a
v-for="(post, index) in store.posts" v-for="(post, index) in store.posts" :key="post.title" href="#" :class="{
:key="post.title"
href="#"
:class="{
'bg-primary text-primary-foreground shadow-lg border-2 border-primary': store.currentPostIndex === index, 'bg-primary text-primary-foreground shadow-lg border-2 border-primary': store.currentPostIndex === index,
'dark:bg-primary-dark dark:text-primary-foreground-dark dark:border-primary-dark': store.currentPostIndex === index, 'dark:bg-primary-dark dark:text-primary-foreground-dark dark:border-primary-dark': store.currentPostIndex === index,
}" }"

View File

@ -40,13 +40,18 @@ const formatOptions = ref<Format[]>([`rgb`, `hex`, `hsl`, `hsv`])
<template> <template>
<div <div
class="overflow-hidden bg-gray/20 transition-width dark:bg-gray/40" class="overflow-hidden bg-gray/20 transition-width duration-300 dark:bg-gray/40"
:class="{ :class="{
'w-0': !store.isOpenRightSlider, 'w-0': !store.isOpenRightSlider,
'w-100': store.isOpenRightSlider, 'w-100': store.isOpenRightSlider,
}" }"
> >
<div class="space-y-4 h-full overflow-auto p-4"> <div
class="space-y-4 h-full overflow-auto p-4 transition-transform" :class="{
'translate-x-0': store.isOpenRightSlider,
'translate-x-full': !store.isOpenRightSlider,
}"
>
<div class="space-y-2"> <div class="space-y-2">
<h2>主题</h2> <h2>主题</h2>
<div class="grid grid-cols-3 justify-items-center gap-2"> <div class="grid grid-cols-3 justify-items-center gap-2">

View File

@ -9,7 +9,6 @@ import {
} from '@/utils' } from '@/utils'
import fileApi from '@/utils/file' import fileApi from '@/utils/file'
import CodeMirror from 'codemirror' import CodeMirror from 'codemirror'
import { PanelLeftClose, PanelLeftOpen } from 'lucide-vue-next'
const store = useStore() const store = useStore()
const displayStore = useDisplayStore() const displayStore = useDisplayStore()
@ -369,23 +368,8 @@ onMounted(() => {
@start-copy="startCopy" @start-copy="startCopy"
@end-copy="endCopy" @end-copy="endCopy"
/> />
<main class="container-main flex-1"> <main class="container-main flex flex-1 flex-col">
<div class="container-main-section h-full flex"> <div class="container-main-section border-radius-10 relative flex flex-1 overflow-hidden border-1">
<div class="flex flex-col border-r p-1">
<TooltipProvider :delay-duration="200">
<Tooltip>
<TooltipTrigger as-child>
<Button size="icon" variant="ghost" @click="store.isOpenPostSlider = !store.isOpenPostSlider">
<PanelLeftOpen v-show="!store.isOpenPostSlider" class="size-4" />
<PanelLeftClose v-show="store.isOpenPostSlider" class="size-4" />
</Button>
</TooltipTrigger>
<TooltipContent side="right">
{{ store.isOpenPostSlider ? "关闭" : "展开" }}
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<PostSlider /> <PostSlider />
<div <div
ref="codeMirrorWrapper" ref="codeMirrorWrapper"
@ -436,7 +420,7 @@ onMounted(() => {
class="preview-wrapper flex-1 p-5" class="preview-wrapper flex-1 p-5"
> >
<div id="output-wrapper" :class="{ output_night: !backLight }"> <div id="output-wrapper" :class="{ output_night: !backLight }">
<div class="preview border shadow-xl"> <div class="preview border-x-1 shadow-xl">
<section id="output" v-html="output" /> <section id="output" v-html="output" />
<div v-if="isCoping" class="loading-mask"> <div v-if="isCoping" class="loading-mask">
<div class="loading-mask-box"> <div class="loading-mask-box">
@ -450,7 +434,7 @@ onMounted(() => {
<CssEditor class="order-2 flex-1" /> <CssEditor class="order-2 flex-1" />
<RightSlider class="order-2" /> <RightSlider class="order-2" />
</div> </div>
<footer class="flex flex-1 justify-end pr-5 text-[12px]"> <footer class="h-[30px] flex items-center justify-end text-[12px]">
字数 {{ readingTime?.words }} 阅读大约需 {{ Math.ceil(readingTime?.minutes ?? 0) }} 分钟 字数 {{ readingTime?.words }} 阅读大约需 {{ Math.ceil(readingTime?.minutes ?? 0) }} 分钟
</footer> </footer>
@ -493,6 +477,7 @@ onMounted(() => {
.container-main { .container-main {
overflow: hidden; overflow: hidden;
padding: 0 20px;
} }
#output-wrapper { #output-wrapper {