style: viewcode scrollbar color

This commit is contained in:
jialin
2024-10-25 20:52:15 +08:00
parent abdc78e123
commit a185bd9463
5 changed files with 40 additions and 13 deletions
@@ -74,7 +74,10 @@ const CodeViewer: React.FC<CodeViewerProps> = (props) => {
> >
<code <code
style={{ minHeight: height }} style={{ minHeight: height }}
className={highlightedCode.className} className={classNames(highlightedCode.className, {
dark: props.theme === 'dark',
light: props.theme === 'light'
})}
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: highlightedCode.value __html: highlightedCode.value
}} }}
@@ -20,6 +20,7 @@
background-color: transparent; background-color: transparent;
} }
&.light {
&:hover { &:hover {
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
background-color: var(--color-scrollbar-thumb); background-color: var(--color-scrollbar-thumb);
@@ -28,6 +29,16 @@
} }
} }
&.dark {
&:hover {
&::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-handle-light-bg);
border-radius: 4px;
}
}
}
}
.code-pre { .code-pre {
padding-inline: 12px 12px; padding-inline: 12px 12px;
position: relative; position: relative;
+1
View File
@@ -15,6 +15,7 @@ html {
--color-scrollbar-thumb: rgba(193, 193, 193, 80%); --color-scrollbar-thumb: rgba(193, 193, 193, 80%);
--scrollbar-size: 6px; --scrollbar-size: 6px;
--scrollbar-handle-bg: rgba(0, 0, 0, 44%); --scrollbar-handle-bg: rgba(0, 0, 0, 44%);
--scrollbar-handle-light-bg: rgba(255, 255, 255, 44%);
--scrollbar-handle-hover-bg: rgba(0, 0, 0, 55%); --scrollbar-handle-hover-bg: rgba(0, 0, 0, 55%);
--color-editor-dark: #282c34; --color-editor-dark: #282c34;
--color-editor-light: #fafafa; --color-editor-light: #fafafa;
@@ -162,9 +162,14 @@ const MessageInput: React.FC<MessageInputProps> = ({
setOpen(true); setOpen(true);
}; };
const handleAddMessage = () => { const handleAddMessage = (e?: any) => {
e?.preventDefault();
addMessage?.({ ...message }); addMessage?.({ ...message });
resetMessage(); resetMessage();
setFocused(true);
setTimeout(() => {
inputRef.current?.focus?.();
}, 100);
}; };
const getPasteContent = useCallback( const getPasteContent = useCallback(
@@ -135,6 +135,12 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
backgroundColor: 'var(--color-editor-dark)' backgroundColor: 'var(--color-editor-dark)'
} }
}} }}
>
<div
style={{
paddingRight: 2,
paddingBottom: 2
}}
> >
<HighlightCode <HighlightCode
height={380} height={380}
@@ -143,6 +149,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
lang={lang} lang={lang}
copyable={false} copyable={false}
></HighlightCode> ></HighlightCode>
</div>
</EditorWrap> </EditorWrap>
<div <div
style={{ marginTop: 10, display: 'flex', alignItems: 'baseline' }} style={{ marginTop: 10, display: 'flex', alignItems: 'baseline' }}