all sizes

This commit is contained in:
Alejandro Gomez
2023-02-12 19:09:15 +01:00
committed by Kieran
parent 2f82d419e2
commit cd17897238
7 changed files with 40 additions and 24 deletions

View File

@ -45,20 +45,23 @@
.nip05 .badge { .nip05 .badge {
color: var(--highlight); color: var(--highlight);
margin-left: 0.1em; margin-left: 0.2em;
} }
@media (max-width: 520px) { @media (max-width: 720px) {
.nip05 {
font-size: var(--font-size-small);
}
}
@media (max-width: 420px) {
.zap .pfp .display-name {
align-items: center;
}
.nip05 .nick { .nip05 .nick {
display: none; display: none;
} }
.nip05 .domain { .nip05 .domain {
display: none; display: none;
} }
.nip05 .badge svg {
width: 13px;
height: 13px;
margin-left: 0.15em;
margin-bottom: 1px;
}
} }

View File

@ -199,7 +199,6 @@
} }
.note .header .nip05 .badge { .note .header .nip05 .badge {
margin-top: -0.2em;
width: 13px; width: 13px;
height: 13px; height: 13px;
} }

View File

@ -32,13 +32,17 @@
.pfp .display-name { .pfp .display-name {
display: flex; display: flex;
flex-direction: row; flex-direction: column;
align-items: center; align-items: flex-start;
} }
@media (min-width: 520px) { @media (max-width: 420px) {
.pfp .display-name { .pfp .display-name {
align-items: flex-start; font-size: var(--font-size-small);
flex-direction: column; flex-direction: row;
} }
} }
.pfp .subheader .about {
max-width: calc(100vw - 140px);
}

View File

@ -32,7 +32,7 @@ export default function ProfileImage({
const navigate = useNavigate(); const navigate = useNavigate();
const user = useUserProfile(pubkey); const user = useUserProfile(pubkey);
const nip05 = defaultNip ? defaultNip : user?.nip05; const nip05 = defaultNip ? defaultNip : user?.nip05;
const { ref, width } = useClientWidth(); const width = useClientWidth();
const name = useMemo(() => { const name = useMemo(() => {
return getDisplayName(user, pubkey); return getDisplayName(user, pubkey);
@ -43,7 +43,7 @@ export default function ProfileImage({
} }
return ( return (
<div className={`pfp${className ? ` ${className}` : ""}`} ref={ref}> <div className={`pfp${className ? ` ${className}` : ""}`}>
<div className="avatar-wrapper"> <div className="avatar-wrapper">
<Avatar user={user} onClick={() => navigate(link ?? profileLink(pubkey))} /> <Avatar user={user} onClick={() => navigate(link ?? profileLink(pubkey))} />
</div> </div>
@ -51,11 +51,11 @@ export default function ProfileImage({
<div className="profile-name"> <div className="profile-name">
<div className="username"> <div className="username">
<Link className="display-name" key={pubkey} to={link ?? profileLink(pubkey)}> <Link className="display-name" key={pubkey} to={link ?? profileLink(pubkey)}>
{name} <div>{name}</div>
{nip05 && <Nip05 nip05={nip05} pubkey={pubkey} verifyNip={verifyNip} />} {nip05 && <Nip05 nip05={nip05} pubkey={pubkey} verifyNip={verifyNip} />}
</Link> </Link>
</div> </div>
<div className="subheader" style={{ width: width - 80 }}> <div className="subheader" style={{ width: width - 190 }}>
{subHeader} {subHeader}
</div> </div>
</div> </div>

View File

@ -87,3 +87,9 @@
.zap.note .body { .zap.note .body {
margin-bottom: 0; margin-bottom: 0;
} }
@media (max-width: 420px) {
.zap .nip05 .badge {
margin: 0 0 0 0.3em;
}
}

View File

@ -1,13 +1,13 @@
import { useRef, useState, useEffect } from "react"; import { useRef, useState, useEffect } from "react";
export default function useClientWidth() { export default function useClientWidth() {
const ref = useRef<HTMLDivElement | null>(null); const ref = useRef<HTMLDivElement | null>(document.querySelector(".page"));
const [width, setWidth] = useState(0); const [width, setWidth] = useState(0);
useEffect(() => { useEffect(() => {
const updateSize = () => { const updateSize = () => {
if (ref.current) { if (ref.current) {
setWidth(ref.current.clientWidth); setWidth(ref.current.offsetWidth);
} }
}; };
@ -16,8 +16,5 @@ export default function useClientWidth() {
return () => window.removeEventListener("resize", updateSize); return () => window.removeEventListener("resize", updateSize);
}, [ref]); }, [ref]);
return { return width;
ref,
width,
};
} }

View File

@ -265,3 +265,10 @@
font-weight: 500; font-weight: 500;
font-size: 24px; font-size: 24px;
} }
.profile .nip05 .nick {
display: unset;
}
.profile .nip05 .domain {
display: unset;
}