Kaynağa Gözat

fix: 更换侧边栏尺寸以及社交媒体间距

Before 5 ay önce
ebeveyn
işleme
a761271b84

+ 1 - 1
src/app/[locale]/(TabBar)/[[...share]]/@mediaWidget/page.tsx

@@ -5,7 +5,7 @@ const Page = async () => {
     const socials = await getSocialsApi();
     if (socials.length === 0) return null;
     return (
-        <div className={"mb-[0.0694rem]"}>
+        <div className={"mb-[0.0694rem] px-[0.4167rem]"}>
             <Media socials={socials} />
         </div>
     );

+ 6 - 0
src/components/Box/index.tsx

@@ -25,6 +25,8 @@ interface Props {
     // 点击功能, 1:无功能,2:跳转外部链接,3:跳转页面,4:跳转弹窗,5:跳转打开游戏,6:跳转Live Chat客服,7:跳转内部文档
     action?: ActionType;
     actionData?: unknown;
+
+    onBeforeHandler?: () => void;
 }
 
 /**
@@ -122,6 +124,7 @@ const Box: FC<PropsWithChildren<Props>> = (props) => {
         Tag = "div",
         action = undefined,
         actionData = undefined,
+        onBeforeHandler,
     } = props;
 
     const cls = clsx(
@@ -135,6 +138,9 @@ const Box: FC<PropsWithChildren<Props>> = (props) => {
 
     const handler = () => {
         if (!action) return;
+        if (onBeforeHandler) {
+            onBeforeHandler();
+        }
         switch (action) {
             case 1:
                 return;

+ 9 - 1
src/components/Layout/Sidebar.tsx

@@ -156,13 +156,21 @@ const Sidebar: FC<PropsWithChildren<Props>> = (props) => {
                                 className="shadow-md"
                                 none={true}
                                 key={index}
+                                onBeforeHandler={() => {
+                                    // 关闭侧边栏按钮
+                                    setCollapse(false);
+                                    // 关闭swiper
+                                    swiper.slideNext();
+                                }}
                                 action={item.action_type}
                                 actionData={item.action_params}
                             >
                                 <img
                                     src={item.content}
                                     alt=""
-                                    className={"h-[60px] w-[100%] rounded-[0.04rem] object-contain"}
+                                    className={
+                                        "h-[0.5556rem] w-[100%] rounded-[0.04rem] object-contain"
+                                    }
                                 />
                             </Box>
                         );