mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-23 00:56:23 +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-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',
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
•{' '}
|
||||
|
|
Loading…
Reference in a new issue