bug: use page width for banner

This commit is contained in:
2023-01-31 16:07:46 +00:00
parent 08acab4831
commit 14769f8f33
2 changed files with 132 additions and 131 deletions

View File

@ -2,13 +2,13 @@ import useImgProxy from "Feed/ImgProxy";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
export const ProxyImg = (props: any) => { export const ProxyImg = (props: any) => {
const { src, ...rest } = props; const { src, size, ...rest } = props;
const [url, setUrl] = useState<string>(); const [url, setUrl] = useState<string>();
const { proxy } = useImgProxy(); const { proxy } = useImgProxy();
useEffect(() => { useEffect(() => {
if (src) { if (src) {
proxy(src) proxy(src, size)
.then(a => setUrl(a)) .then(a => setUrl(a))
.catch(console.warn); .catch(console.warn);
} }

View File

@ -191,10 +191,11 @@ export default function ProfilePage() {
return <div className={`tab f-1${tab === v ? " active" : ""}`} key={v} onClick={() => setTab(v)}>{v}</div> return <div className={`tab f-1${tab === v ? " active" : ""}`} key={v} onClick={() => setTab(v)}>{v}</div>
} }
const w = window.document.querySelector(".page")?.clientWidth;
return ( return (
<> <>
<div className="profile flex"> <div className="profile flex">
{user?.banner && <ProxyImg alt="banner" className="banner" src={user.banner} />} {user?.banner && <ProxyImg alt="banner" className="banner" src={user.banner} size={w}/>}
<div className="profile-wrapper flex"> <div className="profile-wrapper flex">
{avatar()} {avatar()}
{userDetails()} {userDetails()}