1
0
Fork 0

Add a nice pointer

This commit is contained in:
Lim Chee Aun 2022-12-29 11:47:10 +08:00
parent 160b535552
commit bdcefb1ab0
3 changed files with 18 additions and 0 deletions

View file

@ -18,6 +18,7 @@ const ICONS = {
'arrow-left': 'mingcute:arrow-left-line',
'arrow-right': 'mingcute:arrow-right-line',
'arrow-up': 'mingcute:arrow-up-line',
'arrow-down': 'mingcute:arrow-down-line',
earth: 'mingcute:earth-line',
lock: 'mingcute:lock-line',
unlock: 'mingcute:unlock-line',

View file

@ -24,6 +24,10 @@
display: inline-block;
margin-bottom: 0.25em;
}
.hero-heading .icon {
vertical-align: middle;
color: var(--text-insignificant-color);
}
.hero-heading .insignificant {
font-weight: normal;
}

View file

@ -268,6 +268,12 @@ function StatusPage({ id }) {
const [heroInView, setHeroInView] = useState(true);
const onView = useDebouncedCallback(setHeroInView, 100);
const heroPointer = useMemo(() => {
// get top offset of heroStatus
if (!heroStatusRef.current) return null;
const { top } = heroStatusRef.current.getBoundingClientRect();
return top > 0 ? 'down' : 'up';
}, [heroInView]);
return (
<div class="deck-backdrop">
@ -300,6 +306,13 @@ function StatusPage({ id }) {
<h1>
{!heroInView && heroStatus ? (
<span class="hero-heading">
{!!heroPointer && (
<>
<Icon
icon={heroPointer === 'down' ? 'arrow-down' : 'arrow-up'}
/>{' '}
</>
)}
<NameText showAvatar account={heroStatus.account} short />{' '}
<span class="insignificant">
&bull;{' '}