Skip to content

Commit

Permalink
Merge branch 'tangly1024:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
expoli authored Dec 11, 2022
2 parents 6055b0f + 6d0bc92 commit 31c4d63
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
11 changes: 11 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,15 @@ nav {

.wl-meta > span {
@apply dark:bg-gray-800 !important
}

/* 固定两行 */
.text-line-2 {
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-wrap: break-word;
word-break: break-all;
}
14 changes: 8 additions & 6 deletions themes/hexo/components/LatestPostsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import { useRouter } from 'next/router'
* @constructor
*/
const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
if (!latestPosts) {
return <></>
}
// 获取当前路径
const currentPath = useRouter().asPath
const { locale } = useGlobal()

if (!latestPosts) {
return <></>
}

return (
<>
<div className=" mb-2 px-1 flex flex-nowrap justify-between">
Expand All @@ -37,20 +39,20 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
href={`${BLOG.SUB_PATH}/${post.slug}`}
passHref
>
<a className={'my-1 flex '}>
<a className={'my-2 flex'}>
<div
className="w-20 h-16 bg-cover bg-center bg-no-repeat"
style={{ backgroundImage: headerImage }}
/>
<div
className={
(selected ? ' text-indigo-400 ' : 'dark:text-gray-400 ') +
' text-sm py-1.5 overflow-x-hidden hover:text-indigo-600 px-2 duration-200 w-full rounded ' +
' text-sm overflow-x-hidden hover:text-indigo-600 px-2 duration-200 w-full rounded ' +
'hover:text-white dark:hover:text-indigo-400 cursor-pointer items-center flex'
}
>
<div>
<div style={{ WebkitLineClamp: 2 }}>{post.title}</div>
<div className='text-line-2'>{post.title}</div>
<div className="text-gray-500">{post.lastEditedTime}</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions themes/next/components/LatestPostsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import { useRouter } from 'next/router'
* @constructor
*/
const LatestPostsGroup = ({ latestPosts }) => {
if (!latestPosts) {
return <></>
}
// 获取当前路径
const currentPath = useRouter().asPath
const { locale } = useGlobal()

if (!latestPosts) {
return <></>
}

return (
<>
<div className="text-sm pb-1 px-2 flex flex-nowrap justify-between">
Expand All @@ -40,12 +41,11 @@ const LatestPostsGroup = ({ latestPosts }) => {
(selected
? 'text-white bg-gray-600 '
: 'text-gray-500 dark:text-gray-400 ') +
' text-xs py-1.5 flex overflow-x-hidden whitespace-nowrap hover:bg-gray-500 px-2 duration-200 w-full ' +
' text-xs py-1.5 flex hover:bg-gray-500 px-2 duration-200 w-full ' +
'hover:text-white dark:hover:text-white cursor-pointer'
}
>
<i className="mr-2 fas fa-file-alt" />
<div className="truncate">{post.title}</div>
<li className="text-line-2">{post.title}</li>
</div>
</a>
</Link>
Expand Down

1 comment on commit 31c4d63

@vercel
Copy link

@vercel vercel bot commented on 31c4d63 Dec 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.