feat: add scrollbar style

This commit is contained in:
kangfenmao 2024-07-09 19:58:51 +08:00
parent e3dcfef024
commit f7c5c1551a
4 changed files with 32 additions and 4 deletions

View File

@ -98,3 +98,32 @@ body,
#inputbar .ant-input { #inputbar .ant-input {
resize: none; resize: none;
} }
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* 全局初始化滚动条样式 */
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.6);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.8);
}
/* Safari 和 Chrome */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
body {
scrollbar-width: thin; /* 告诉 FF 用细滚动条 */
scrollbar-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.1); /* FF 前面色后面色 */
}
}
}

View File

@ -28,6 +28,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({ children, className, ...rest }) =
{...rest} {...rest}
language={match[1]} language={match[1]}
style={atomDark} style={atomDark}
wrapLongLines={true}
customStyle={{ borderTopLeftRadius: 0, borderTopRightRadius: 0, marginTop: 0 }}> customStyle={{ borderTopLeftRadius: 0, borderTopRightRadius: 0, marginTop: 0 }}>
{String(children).replace(/\n$/, '')} {String(children).replace(/\n$/, '')}
</SyntaxHighlighter> </SyntaxHighlighter>

View File

@ -108,14 +108,11 @@ const Messages: FC<Props> = ({ assistant, topic }) => {
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: scroll; overflow-y: auto;
flex-direction: column-reverse; flex-direction: column-reverse;
max-height: calc(100vh - var(--input-bar-height) - var(--navbar-height)); max-height: calc(100vh - var(--input-bar-height) - var(--navbar-height));
padding-top: 10px; padding-top: 10px;
padding-bottom: 20px; padding-bottom: 20px;
&::-webkit-scrollbar {
display: none;
}
` `
export default Messages export default Messages

View File

@ -112,6 +112,7 @@ const Container = styled.div`
height: 100%; height: 100%;
border-left: 0.5px solid var(--color-border); border-left: 0.5px solid var(--color-border);
padding: 10px; padding: 10px;
overflow-y: auto;
&.collapsed { &.collapsed {
width: 0; width: 0;
border-left: none; border-left: none;