From a5e9eee13603c85c512d0b4d519e166d8a3176ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E7=AC=91=E5=AF=92?= Date: Sat, 16 Mar 2024 02:59:36 -0400 Subject: [PATCH] refactor: simplify unocss classes --- src/components/AppWindow.tsx | 10 +- src/components/Launchpad.tsx | 4 +- src/components/Spotlight.tsx | 84 ++++++++-------- src/components/apps/Bear.tsx | 111 ++++++++++----------- src/components/apps/FaceTime.tsx | 7 +- src/components/apps/Safari.tsx | 75 +++++++------- src/components/apps/Terminal.tsx | 53 +++++----- src/components/apps/Typora.tsx | 2 +- src/components/apps/VSCode.tsx | 2 +- src/components/dock/Dock.tsx | 16 +-- src/components/dock/DockItem.tsx | 14 ++- src/components/menus/Battery.tsx | 2 +- src/components/menus/ControlCenterMenu.tsx | 15 ++- src/components/menus/WifiMenu.tsx | 6 +- src/components/menus/base.tsx | 2 +- src/pages/Boot.tsx | 8 +- src/pages/Desktop.tsx | 2 +- src/pages/Login.tsx | 18 ++-- src/styles/bear.css | 10 +- src/styles/component.css | 30 +++--- src/styles/typora.css | 4 +- unocss.config.ts | 33 +++--- 22 files changed, 248 insertions(+), 260 deletions(-) diff --git a/src/components/AppWindow.tsx b/src/components/AppWindow.tsx index 27b698c8..647eb4b6 100644 --- a/src/components/AppWindow.tsx +++ b/src/components/AppWindow.tsx @@ -86,7 +86,7 @@ const TrafficLights = ({ id, close, aspectRatio, max, setMax, setMin }: TrafficP - -
- { value={state.currentURL} onChange={(e) => setState({ ...state, currentURL: e.target.value })} onKeyPress={pressURL} - className="h-6 w-full p-2 rounded font-normal no-outline text-sm text-center c-text-500 c-bg-200" + className="h-6 w-full p-2 rounded font-normal no-outline text-sm text-center text-c-500 bg-c-200" border="2 transparent focus:blue-400 dark:focus:blue-500" placeholder="Search or enter website name" /> @@ -206,7 +199,7 @@ const Safari = ({ width }: SafariProps) => { -
diff --git a/src/components/apps/Terminal.tsx b/src/components/apps/Terminal.tsx index a4d0da8d..f2b3edae 100644 --- a/src/components/apps/Terminal.tsx +++ b/src/components/apps/Terminal.tsx @@ -8,8 +8,7 @@ const getEmoji = () => { return emojis[Math.floor(Math.random() * emojis.length)]; }; -const characters = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789富强民主文明和谐自由平等公正法治爱国敬业诚信友善"; +const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789落霞与孤鹜齐飞秋水共长天一色"; interface HowDareProps { setRMRF: (value: boolean) => void; @@ -78,14 +77,14 @@ class HowDare extends React.Component { return (
this.props.setRMRF(false)} > -
-
{this.emoji}
-
HOW DARE YOU!
-
Click to go back
+
+
{this.emoji}
+
HOW DARE YOU!
+
Click to go back
); @@ -226,33 +225,31 @@ export default class Terminal extends React.Component<{}, TerminalState> { const help = (
  • - cat {""} - See the content of{" "} - {""} + cat {""} - See the content of {""}
  • - cd {""} - Move into + cd {""} - Move into {" "}, "cd .." to move to the parent directory, "cd" or "cd ~" to return to root
  • - ls - See files and directories in the - current directory + ls - See files and directories in the current + directory
  • - clear - Clear the screen + clear - Clear the screen
  • - help - Display this help menu + help - Display this help menu
  • - rm -rf / - :) + rm -rf / - :)
  • - press up arrow / down arrow - Select - history commands + press up arrow / down arrow - Select history commands
  • - press tab - Auto complete + press tab - Auto complete
); @@ -349,16 +346,16 @@ export default class Terminal extends React.Component<{}, TerminalState> { generateInputRow = (id: number): void => { const newRow = ( -
-
- - zou@macbook-pro {this.getCurDirName()} +
+
+ + zou@macbook-pro {this.getCurDirName()} - {">"} + {">"}
@@ -369,7 +366,7 @@ export default class Terminal extends React.Component<{}, TerminalState> { generateResultRow = (id: number, result: JSX.Element) => { const newRow = ( -
+
{result}
); @@ -379,18 +376,18 @@ export default class Terminal extends React.Component<{}, TerminalState> { render() { return (
this.focusOnInput(this.curInputTimes)} > {this.state.rmrf && ( this.setState({ rmrf: value })} /> )} -
+
ヽ(ˋ▽ˊ)ノ: Hey, you found the terminal! Type `help` to get started.
-
+
{this.state.content}
diff --git a/src/components/apps/Typora.tsx b/src/components/apps/Typora.tsx index 1bace51c..21670d19 100644 --- a/src/components/apps/Typora.tsx +++ b/src/components/apps/Typora.tsx @@ -28,7 +28,7 @@ const MilkdownEditor = () => { .markdownUpdated((_, markdown) => setTyporaMd(markdown)); root.className = - "typora bg-white dark:bg-gray-800 c-text-700 h-full overflow-y-scroll"; + "typora bg-white dark:bg-gray-800 text-c-700 h-full overflow-y-scroll"; }) .use(listener) .use(commonmark) diff --git a/src/components/apps/VSCode.tsx b/src/components/apps/VSCode.tsx index cdea21fe..2b648b05 100644 --- a/src/components/apps/VSCode.tsx +++ b/src/components/apps/VSCode.tsx @@ -1,7 +1,7 @@ export default function VSCode() { return (