Custom titleComponent for Timeline
This commit is contained in:
parent
b106d1d519
commit
9a261470df
3 changed files with 28 additions and 1 deletions
11
src/app.css
11
src/app.css
|
@ -1170,6 +1170,17 @@ meter.donut:is(.danger, .explode):after {
|
||||||
text-shadow: 0 1px var(--bg-color);
|
text-shadow: 0 1px var(--bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ACCOUNT STATUSES */
|
||||||
|
|
||||||
|
.header-account {
|
||||||
|
font-size: 90% !important;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.header-account div {
|
||||||
|
font-weight: normal;
|
||||||
|
color: var(--text-insignificant-color);
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 40em) {
|
@media (min-width: 40em) {
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import Status from './status';
|
||||||
|
|
||||||
function Timeline({
|
function Timeline({
|
||||||
title,
|
title,
|
||||||
|
titleComponent,
|
||||||
path,
|
path,
|
||||||
id,
|
id,
|
||||||
emptyText,
|
emptyText,
|
||||||
|
@ -90,7 +91,8 @@ function Timeline({
|
||||||
<Icon icon="home" size="l" />
|
<Icon icon="home" size="l" />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<h1>{title}</h1>
|
{uiState !== 'loading' &&
|
||||||
|
(titleComponent ? titleComponent : <h1>{title}</h1>)}
|
||||||
<div class="header-side">
|
<div class="header-side">
|
||||||
<Loader hidden={uiState !== 'loading'} />
|
<Loader hidden={uiState !== 'loading'} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'preact/hooks';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import Timeline from '../components/timeline';
|
import Timeline from '../components/timeline';
|
||||||
|
import states from '../utils/states';
|
||||||
|
|
||||||
const LIMIT = 20;
|
const LIMIT = 20;
|
||||||
|
|
||||||
|
@ -34,6 +35,19 @@ function AccountStatuses() {
|
||||||
<Timeline
|
<Timeline
|
||||||
key={id}
|
key={id}
|
||||||
title={`${account?.acct ? '@' + account.acct : 'Posts'}`}
|
title={`${account?.acct ? '@' + account.acct : 'Posts'}`}
|
||||||
|
titleComponent={
|
||||||
|
<h1
|
||||||
|
class="header-account"
|
||||||
|
onClick={() => {
|
||||||
|
states.showAccount = account;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{account?.displayName}
|
||||||
|
<div>
|
||||||
|
<span>@{account?.acct}</span>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
}
|
||||||
path="/a/:id"
|
path="/a/:id"
|
||||||
id="account_statuses"
|
id="account_statuses"
|
||||||
emptyText="Nothing to see here yet."
|
emptyText="Nothing to see here yet."
|
||||||
|
|
Loading…
Add table
Reference in a new issue