添加了postsPanel作为通用帖子显示板,增加了对jest测试的配置,添加了论坛主页,设定了论坛全局框架,设定了论坛基础主题色及主题切换、字号切换逻辑
Change-Id: I9fad0cf577088adb00c9850d405ccd23e6072413
diff --git a/src/views/frame/frame.module.css b/src/views/frame/frame.module.css
new file mode 100644
index 0000000..91967f8
--- /dev/null
+++ b/src/views/frame/frame.module.css
@@ -0,0 +1,63 @@
+
+
+.header{
+ display:flex;
+ justify-content: space-between;
+ align-items: center;
+ height:8%;
+ background-color: var(--bg-color);
+ width: 100%;
+ overflow:hidden;
+}
+
+.header .logo{
+ width: 100px; /* Set a fixed width for the logo */
+ height: auto; /* Maintain aspect ratio */
+ left:0;
+ margin:10px;
+}
+
+.header .searchInput{
+ border:1px solid rgb(197, 193, 194);
+ width: 60%;
+ height:50%;
+ padding: 5px 10px;
+ border-radius: 5px;
+ font-size: 1rem;
+ color: var(--text-color);
+ background-color: var(--bg-color);
+ transition: all 0.1s ease-in-out;
+}
+
+.header .toollist{
+ align-content: center;
+ right:0;
+ gap:10px;
+ margin-right:10px;
+}
+
+.header .toollist > *{
+ padding: 5px 10px;
+ width:auto;
+ font-size:150%;
+ user-select: none;
+ color: var(--text-color);
+}
+
+.header .toollist > *:hover{
+ background-color: rgb(197, 193, 194);
+ border-radius: 5px;
+ cursor: pointer;
+ font-size:160%;
+ transition: all 0.1s ease-in-out;
+ color: var(--text-color);
+}
+
+.container{
+ height:92vh;
+ background-color:var(--bg-color);
+ display:flex;
+ flex-direction:column;
+ overflow: auto;
+ width:100%;
+}
\ No newline at end of file
diff --git a/src/views/frame/frame.tsx b/src/views/frame/frame.tsx
new file mode 100644
index 0000000..c0c2e0e
--- /dev/null
+++ b/src/views/frame/frame.tsx
@@ -0,0 +1,55 @@
+import React from "react";
+import { Outlet } from "react-router";
+import { useEffect, useState } from "react";
+import {
+ SearchOutlined,
+ FontSizeOutlined,
+ MessageOutlined,
+ SunOutlined,
+ MoonOutlined
+ } from "@ant-design/icons";
+import style from "./frame.module.css";
+import logo from "&/assets/logo.png";
+import { useAppDispatch } from "@/hooks/store";
+import { useSelector } from "react-redux";
+const Frame:React.FC = () => {
+
+ const dispatch = useAppDispatch();
+
+ const showSearch = useSelector((state: any) => state.setting.showSearch);
+ const theme= useSelector((state: any) => state.setting.theme);
+ const toggleSearch = () => {
+ dispatch({ type: "setting/toggleSearch" });
+ }
+
+ const toggleFontSize = () => {
+ dispatch({ type: "setting/toggleFontSize" });
+ };
+
+ const toggleTheme = () => {
+ dispatch({ type: "setting/toggleTheme" });
+ };
+
+
+ return (
+ <div style={{ display: 'block', height: '100vh' }}>
+ <header className={style.header}>
+ <img className={style.logo} src={logo} alt="website logo"></img>
+ {showSearch && (<input className={style.searchInput} placeholder="输入关键词进行搜索"/>)}
+ <div className={style.toollist}>
+ <SearchOutlined onClick={toggleSearch}/>
+ <FontSizeOutlined onClick={toggleFontSize}/>
+ <MessageOutlined />
+ {theme === 'dark' ? <MoonOutlined onClick={toggleTheme}/> : <SunOutlined onClick={toggleTheme}/>}
+ </div>
+ </header>
+ <div className={style.container}>
+ <Outlet/>
+ </div>
+
+
+ </div>
+ );
+}
+
+export default Frame;
\ No newline at end of file