mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-09 01:26:24 +01:00
Add a nice pointer
This commit is contained in:
parent
160b535552
commit
bdcefb1ab0
3 changed files with 18 additions and 0 deletions
|
@ -18,6 +18,7 @@ const ICONS = {
|
||||||
'arrow-left': 'mingcute:arrow-left-line',
|
'arrow-left': 'mingcute:arrow-left-line',
|
||||||
'arrow-right': 'mingcute:arrow-right-line',
|
'arrow-right': 'mingcute:arrow-right-line',
|
||||||
'arrow-up': 'mingcute:arrow-up-line',
|
'arrow-up': 'mingcute:arrow-up-line',
|
||||||
|
'arrow-down': 'mingcute:arrow-down-line',
|
||||||
earth: 'mingcute:earth-line',
|
earth: 'mingcute:earth-line',
|
||||||
lock: 'mingcute:lock-line',
|
lock: 'mingcute:lock-line',
|
||||||
unlock: 'mingcute:unlock-line',
|
unlock: 'mingcute:unlock-line',
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 0.25em;
|
margin-bottom: 0.25em;
|
||||||
}
|
}
|
||||||
|
.hero-heading .icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
color: var(--text-insignificant-color);
|
||||||
|
}
|
||||||
.hero-heading .insignificant {
|
.hero-heading .insignificant {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,6 +268,12 @@ function StatusPage({ id }) {
|
||||||
|
|
||||||
const [heroInView, setHeroInView] = useState(true);
|
const [heroInView, setHeroInView] = useState(true);
|
||||||
const onView = useDebouncedCallback(setHeroInView, 100);
|
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 (
|
return (
|
||||||
<div class="deck-backdrop">
|
<div class="deck-backdrop">
|
||||||
|
@ -300,6 +306,13 @@ function StatusPage({ id }) {
|
||||||
<h1>
|
<h1>
|
||||||
{!heroInView && heroStatus ? (
|
{!heroInView && heroStatus ? (
|
||||||
<span class="hero-heading">
|
<span class="hero-heading">
|
||||||
|
{!!heroPointer && (
|
||||||
|
<>
|
||||||
|
<Icon
|
||||||
|
icon={heroPointer === 'down' ? 'arrow-down' : 'arrow-up'}
|
||||||
|
/>{' '}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<NameText showAvatar account={heroStatus.account} short />{' '}
|
<NameText showAvatar account={heroStatus.account} short />{' '}
|
||||||
<span class="insignificant">
|
<span class="insignificant">
|
||||||
•{' '}
|
•{' '}
|
||||||
|
|
Loading…
Reference in a new issue