From 6c57a6147f909e24faac7be5f9509bf08d0fe379 Mon Sep 17 00:00:00 2001 From: master1lan <278457198@qq.com> Date: Sat, 14 Jan 2023 20:37:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=86=E9=A2=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routers/video/item/icon.tsx | 63 ++++++++++++++----------- src/routers/video/item/item.module.less | 33 +++---------- src/routers/video/item/videodata.tsx | 35 +++++++------- src/routers/video/item/videoinfo.tsx | 10 ++-- vite.config.ts | 1 + 5 files changed, 67 insertions(+), 75 deletions(-) diff --git a/src/routers/video/item/icon.tsx b/src/routers/video/item/icon.tsx index e2a4713..76f4673 100644 --- a/src/routers/video/item/icon.tsx +++ b/src/routers/video/item/icon.tsx @@ -33,36 +33,45 @@ export const UPIcon: FC<{ width?: number | string; color?: string; title: string; -}> = ({ height, width = height, color = "#fff", title }) => ( - +}> = ({ height, width = height, color = "#8A8A8A", title }) => ( + + {title} - {title} - - - - - - - - + + + + + - - UP - ); + +export const PlayIcon: FC<{ + height: number | string; + width?: number | string; +}> = ({ height, width = height }) => ( + + + + +); diff --git a/src/routers/video/item/item.module.less b/src/routers/video/item/item.module.less index 7df84e1..504eb43 100644 --- a/src/routers/video/item/item.module.less +++ b/src/routers/video/item/item.module.less @@ -5,17 +5,11 @@ .video-data { transition: opacity .3s linear; - - *:hover+& { - opacity: 0; - } - position: absolute; left: 0; bottom: 0; width: 100%; box-sizing: border-box; - padding: 16px 8px 6px; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; display: flex; @@ -25,8 +19,8 @@ font-size: 13px; font-weight: 400; background-image: linear-gradient(180deg, - rgba(0, 0, 0, 0) 0%, - rgba(0, 0, 0, .8) 100%); + rgba(0, 0, 0, 0) 0%, + rgba(0, 0, 0, .8) 100%); &-left { flex: 1; @@ -70,7 +64,7 @@ .video-up { display: flex; - align-items: center; + align-items: stretch; &>*:not(:first-child) { margin-left: 5px; @@ -81,27 +75,10 @@ } &-desc { - flex: 1; font-size: 13px; display: flex; flex-flow: column nowrap; - justify-content: space-between; - cursor: default; - - &-data { - flex: 1; - display: flex; - flex-flow: row nowrap; - justify-content: space-evenly; - &>span { - white-space: nowrap; - display: flex; - align-items: center; - - - } - } a { @@ -116,7 +93,9 @@ } &>span { - + display: inline-block; + height: 16px; + line-height: 16px; &:not(:first-of-type)::before { content: '·'; diff --git a/src/routers/video/item/videodata.tsx b/src/routers/video/item/videodata.tsx index d7b1b80..0a7255c 100644 --- a/src/routers/video/item/videodata.tsx +++ b/src/routers/video/item/videodata.tsx @@ -6,20 +6,17 @@ import getFixedNumber from "@utils/number"; import { getVideoTime } from "@utils/time"; import { FC } from "react"; import { VideoRouterImageCardType } from "../videotype"; +import { PlayIcon } from "./icon"; import styles from "./item.module.less"; export const VideoData: FC< Pick > = (props) => { const { view, danmaku, duration } = props; return ( -
+
- + {getFixedNumber(view)} @@ -32,24 +29,30 @@ export const VideoData: FC< }, }} > - + {getFixedNumber(danmaku)}
- {getVideoTime(duration)} -
+ {getVideoTime(duration)} + ); }; - +const BorderDiv = styled("div")(({ theme }) => ({ + padding: "16px 8px 6px", + borderBottomLeftRadius: "8px", + borderBottomRightRadius: "8px", + [theme.breakpoints.down("sm")]: { + padding: "8px 6px 4px", + }, +})); const SizeSpan = styled("span")(({ theme }) => ({ fontSize: "13px", - alignItems: "center", display: "flex", + lineHeight: "1", + "&>svg": { + marginRight: "2px", + }, [theme.breakpoints.down("sm")]: { - fontSize: "11px", + fontSize: "12px", }, })); diff --git a/src/routers/video/item/videoinfo.tsx b/src/routers/video/item/videoinfo.tsx index b81c0a2..e7b7bc7 100644 --- a/src/routers/video/item/videoinfo.tsx +++ b/src/routers/video/item/videoinfo.tsx @@ -5,11 +5,12 @@ import { FC } from "react"; import { VideoRouterImageCardType } from "../videotype"; import { UPIcon } from "./icon"; import styles from "./item.module.less"; +import { useScreenSize } from "../../../components/proview/screenSize"; export const VideoInfo: FC< - Pick + Pick > = (props) => { - const { title, name, bvid, pubdate, face } = props; - const matchsmSize = useScreenMatchSize("sm"); + const { title, name, bvid, pubdate } = props; + const { sm } = useScreenSize(); return (
- {/* todo 这里在手机端没对齐 */} {name} - {matchsmSize && {getrealtiveTime(pubdate * 1000)}} + {!sm && {getrealtiveTime(pubdate * 1000)}}
diff --git a/vite.config.ts b/vite.config.ts index 0681cf1..828cc10 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,6 +38,7 @@ export default defineConfig({ manualChunks: { react: ["react", "react-dom"], "react-router": ["react-router-dom"], + "react-redux": ["@reduxjs/toolkit", "react-redux"], lib: [ "@mui/icons-material", "@mui/lab",