Skip to content

Commit

Permalink
fix: 修复屏幕横向增长
Browse files Browse the repository at this point in the history
  • Loading branch information
mslxl committed Dec 8, 2023
1 parent 103d9b8 commit 6ed0421
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"autoprefixer": "^10.4.16",
"postcss": "^8.4.31",
"prettier": "^3.1.0",
"sass": "^1.69.5",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2",
"vite": "^4.5.1",
Expand Down
33 changes: 23 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/components/codemirror/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const Codemirror = memo((props: CodemirrorProps) => {
"&": {
"flex-grow": 1,
outline: "none",
"min-width": "0px"
},
"&.cm-focused": {
outline: "none",
Expand Down Expand Up @@ -82,6 +83,6 @@ const Codemirror = memo((props: CodemirrorProps) => {
}
}, [parentRef])

return <div ref={parentRef} className={clsx("flex items-stretch", props.className)} />
return <div ref={parentRef} className={clsx("flex items-stretch min-w-0", props.className)} />
})
export default Codemirror
7 changes: 6 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import ReactDOM from "react-dom/client"
import "normalize.css"
import "./styles.css"
import "./styles.scss"
import "@fontsource/jetbrains-mono"
import Router from "./router"
import { DndProvider } from "react-dnd"
Expand All @@ -17,6 +17,11 @@ async function maskContextMenu() {
const debug = await isDebug()
if (!debug) {
document.oncontextmenu = (event) => event.preventDefault()
document.addEventListener("keydown", (e) => {
if (e.key == "r" && e.ctrlKey) {
e.preventDefault()
}
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Preference/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PrefCatalog from "./catalog"
import { Suspense } from "react"
import Loading from "@/components/loading"
import { useZoom } from "@/hooks/useZoom"
import { AnimatePresence, motion } from "framer-motion"
import { motion } from "framer-motion"

export default function Preference() {
useZoom()
Expand Down
2 changes: 2 additions & 0 deletions src/styles.css → src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "./styles/scrollbar.scss";
@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down Expand Up @@ -87,3 +88,4 @@ body,
display: flex;
flex-direction: row;
}

14 changes: 14 additions & 0 deletions src/styles/scrollbar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* {
&::-webkit-scrollbar{
width: 6px;
height: 6px;
}
&::-webkit-scrollbar-thumb {
background-color: darkgrey;
outline: 1px solid slategrey;
border-radius: 4px;
}
&::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
}
}

0 comments on commit 6ed0421

Please sign in to comment.