show creator in magazine view

This commit is contained in:
刘浩远 2020-07-24 15:13:10 +08:00
parent 3c44a93e34
commit 7a5ad6deb6
3 changed files with 21 additions and 8 deletions

15
dist/styles/cards.css vendored
View File

@ -1,4 +1,5 @@
.info { .info {
display: flex;
position: relative; position: relative;
margin: 10px 12px; margin: 10px 12px;
line-height: 16px; line-height: 16px;
@ -12,13 +13,20 @@
font-size: 12px; font-size: 12px;
vertical-align: top; vertical-align: top;
display: inline-block; display: inline-block;
max-width: 144px; flex-grow: 1;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.info span.creator {
color: var(--neutralSecondaryAlt);
}
.info span.creator::before {
display: inline-block;
content: "/";
margin: 0 5px;
}
.info span.time { .info span.time {
float: right;
font-size: 12px; font-size: 12px;
} }
@ -26,7 +34,6 @@
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
float: right;
text-align: center; text-align: center;
} }
.read-indicator::after { .read-indicator::after {
@ -81,7 +88,7 @@
background: #0003; background: #0003;
} }
.card span.h { .card span.h {
background: #fce100b0; background: #fce10080;
} }
.default-card { .default-card {

View File

@ -7,15 +7,21 @@ type CardInfoProps = {
source: RSSSource source: RSSSource
item: RSSItem item: RSSItem
hideTime?: boolean hideTime?: boolean
showCreator?: boolean
} }
const CardInfo: React.FunctionComponent<CardInfoProps> = (props) => ( const CardInfo: React.FunctionComponent<CardInfoProps> = (props) => (
<p className="info"> <p className="info">
{props.source.iconurl ? <img src={props.source.iconurl} /> : null} {props.source.iconurl ? <img src={props.source.iconurl} /> : null}
<span className="name">{props.source.name}</span> <span className="name">
{props.hideTime ? null : <Time date={props.item.date} />} {props.source.name}
{props.item.hasRead ? null : <span className="read-indicator"></span>} {props.showCreator && props.item.creator && (
<span className="creator">{props.item.creator}</span>
)}
</span>
{props.item.starred ? <span className="starred-indicator"></span> : null} {props.item.starred ? <span className="starred-indicator"></span> : null}
{props.item.hasRead ? null : <span className="read-indicator"></span>}
{props.hideTime ? null : <Time date={props.item.date} />}
</p> </p>
) )

View File

@ -24,7 +24,7 @@ const MagazineCard: React.FunctionComponent<Card.Props> = (props) => (
<h3 className="title"><Highlights text={props.item.title} keyword={props.keyword} title /></h3> <h3 className="title"><Highlights text={props.item.title} keyword={props.keyword} title /></h3>
<p className="snippet"><Highlights text={props.item.snippet} keyword={props.keyword} /></p> <p className="snippet"><Highlights text={props.item.snippet} keyword={props.keyword} /></p>
</div> </div>
<CardInfo source={props.source} item={props.item} /> <CardInfo source={props.source} item={props.item} showCreator />
</div> </div>
</div> </div>
) )