feat: bring lite topic feed styling to next
This commit is contained in:
1 parent
6a0b6adf61
commit
fea9ad1c48
2 files changed
+86
-10
No files matched your search
@@ -593,6 +593,68 @@ svg {
|
|||||||
box-shadow: 0 12px 28px rgba(25, 45, 65, 0.12);
|
box-shadow: 0 12px 28px rgba(25, 45, 65, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#feed .topic-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 14px 18px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-main {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-title-line {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-title-line .post-title {
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-meta {
|
||||||
|
margin: 5px 0 0;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-preview {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: 4px;
|
||||||
|
color: var(--glass-text-light);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-replies {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-width: 38px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border: 1px solid var(--glass-border);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: color-mix(in srgb, var(--glass-bg) 78%, var(--primary) 22%);
|
||||||
|
color: var(--glass-text-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-actions {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
#feed .post-header {
|
#feed .post-header {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -644,6 +706,18 @@ svg {
|
|||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#feed .topic-row {
|
||||||
|
gap: 10px;
|
||||||
|
padding: 13px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#feed .topic-title-line .post-title {
|
||||||
|
white-space: normal;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
}
|
||||||
|
|
||||||
#feed .post-time {
|
#feed .post-time {
|
||||||
max-width: 42%;
|
max-width: 42%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
+12
-10
@@ -164,12 +164,14 @@ export default function Feed({ onOpenModal, onReport }) {
|
|||||||
posts.map((p) => {
|
posts.map((p) => {
|
||||||
const time = p.created_at ? new Date(p.created_at).toLocaleString('zh-CN') : '';
|
const time = p.created_at ? new Date(p.created_at).toLocaleString('zh-CN') : '';
|
||||||
return (
|
return (
|
||||||
<div key={p.id} className="post-card" data-post-id={p.id} data-post-ref={p.post_number || p.id} data-username={p.username || ''} style={{ cursor: 'pointer' }}
|
<div key={p.id} className="post-card topic-row" data-post-id={p.id} data-post-ref={p.post_number || p.id} data-username={p.username || ''} style={{ cursor: 'pointer' }}
|
||||||
onClick={(e) => openPost(p.post_number || p.id, e.currentTarget, p)}>
|
onClick={(e) => openPost(p.post_number || p.id, e.currentTarget, p)}>
|
||||||
{p.is_pinned && (
|
<div className="topic-main">
|
||||||
<div className="post-pin-state" style={{ width: 'fit-content', display: 'flex', alignItems: 'center', gap: 3, fontSize: 12, color: 'var(--primary)', fontWeight: 600, marginBottom: 4 }}><Icon name="pin" size={12} /> {t('feed.pinned')}</div>
|
<div className="topic-title-line">
|
||||||
)}
|
{p.is_pinned && <span className="post-pin-state"><Icon name="pin" size={12} /> {t('feed.pinned')}</span>}
|
||||||
<div className="post-header">
|
<div className="post-title">{p.title || t('feed.noTitle')}</div>
|
||||||
|
</div>
|
||||||
|
<div className="post-header topic-meta">
|
||||||
<img
|
<img
|
||||||
src={p.avatar_url || avatar(p.username)}
|
src={p.avatar_url || avatar(p.username)}
|
||||||
className="post-avatar"
|
className="post-avatar"
|
||||||
@@ -199,8 +201,7 @@ export default function Feed({ onOpenModal, onReport }) {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="post-title">{p.title || t('feed.noTitle')}</div>
|
<div className="topic-preview" dangerouslySetInnerHTML={{ __html: renderMarkdown(p.content) }} />
|
||||||
<div className="post-content" dangerouslySetInnerHTML={{ __html: renderMarkdown(p.content) }} />
|
|
||||||
{p.images && p.images.length > 0 && (
|
{p.images && p.images.length > 0 && (
|
||||||
<div className="post-images">
|
<div className="post-images">
|
||||||
{p.images.map((img, i) => (
|
{p.images.map((img, i) => (
|
||||||
@@ -208,10 +209,11 @@ export default function Feed({ onOpenModal, onReport }) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="post-actions">
|
</div>
|
||||||
<span className="post-replies" aria-label={`${p.reply_count || 0} replies`}>
|
<div className="topic-replies post-replies" aria-label={`${p.reply_count || 0} replies`}>
|
||||||
<Icon name="message" size={14} /> {p.reply_count || 0}
|
<Icon name="message" size={14} /> {p.reply_count || 0}
|
||||||
</span>
|
</div>
|
||||||
|
<div className="post-actions topic-actions">
|
||||||
<button className="action-report" onClick={(e) => {
|
<button className="action-report" onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (!currentUser) { toast(t('newPost.pleaseLogin'), 'warning'); return; }
|
if (!currentUser) { toast(t('newPost.pleaseLogin'), 'warning'); return; }
|
||||||
|
|||||||
Reference in new issue
Block a user