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,10 +20,21 @@
background-color: transparent; background-color: transparent;
} }
&:hover { &.light {
&::-webkit-scrollbar-thumb { &:hover {
background-color: var(--color-scrollbar-thumb); &::-webkit-scrollbar-thumb {
border-radius: 4px; background-color: var(--color-scrollbar-thumb);
border-radius: 4px;
}
}
}
&.dark {
&:hover {
&::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-handle-light-bg);
border-radius: 4px;
}
} }
} }
} }
+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(
@@ -136,13 +136,20 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
} }
}} }}
> >
<HighlightCode <div
height={380} style={{
theme="dark" paddingRight: 2,
code={codeValue} paddingBottom: 2
lang={lang} }}
copyable={false} >
></HighlightCode> <HighlightCode
height={380}
theme="dark"
code={codeValue}
lang={lang}
copyable={false}
></HighlightCode>
</div>
</EditorWrap> </EditorWrap>
<div <div
style={{ marginTop: 10, display: 'flex', alignItems: 'baseline' }} style={{ marginTop: 10, display: 'flex', alignItems: 'baseline' }}