chore: tweak memo parent styles

pull/2601/head
Steven 1 year ago
parent 77b75aa6c4
commit fa34a7af4b

@ -26,6 +26,7 @@ import "@/less/memo.less";
interface Props { interface Props {
memo: Memo; memo: Memo;
showCreator?: boolean; showCreator?: boolean;
showParent?: boolean;
showVisibility?: boolean; showVisibility?: boolean;
showPinnedStyle?: boolean; showPinnedStyle?: boolean;
lazyRendering?: boolean; lazyRendering?: boolean;
@ -228,7 +229,7 @@ const Memo: React.FC<Props> = (props: Props) => {
> >
<div className="memo-top-wrapper"> <div className="memo-top-wrapper">
<div className="w-full max-w-[calc(100%-20px)] flex flex-row justify-start items-center mr-1"> <div className="w-full max-w-[calc(100%-20px)] flex flex-row justify-start items-center mr-1">
{props.showCreator && ( {props.showCreator && creator && (
<> <>
<Link to={`/u/${encodeURIComponent(memo.creatorUsername)}`}> <Link to={`/u/${encodeURIComponent(memo.creatorUsername)}`}>
<Tooltip title={"Creator"} placement="top"> <Tooltip title={"Creator"} placement="top">
@ -246,14 +247,7 @@ const Memo: React.FC<Props> = (props: Props) => {
<span className="text-sm text-gray-400 select-none" onClick={handleGotoMemoDetailPage}> <span className="text-sm text-gray-400 select-none" onClick={handleGotoMemoDetailPage}>
{displayTime} {displayTime}
</span> </span>
<div className="w-auto hidden group-hover:flex flex-row justify-between items-center"> {props.showPinnedStyle && memo.pinned && (
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
<Link className="flex flex-row justify-start items-center" to={`/m/${memo.id}`}>
<Tooltip title={"Identifier"} placement="top">
<span className="text-sm text-gray-500 dark:text-gray-400">#{memo.id}</span>
</Tooltip>
</Link>
{memo.pinned && props.showPinnedStyle && (
<> <>
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" /> <Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
<Tooltip title={"Pinned"} placement="top"> <Tooltip title={"Pinned"} placement="top">
@ -261,6 +255,13 @@ const Memo: React.FC<Props> = (props: Props) => {
</Tooltip> </Tooltip>
</> </>
)} )}
<div className="w-auto hidden group-hover:flex flex-row justify-between items-center">
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
<Link className="flex flex-row justify-start items-center" to={`/m/${memo.id}`}>
<Tooltip title={"Identifier"} placement="top">
<span className="text-sm text-gray-500 dark:text-gray-400">#{memo.id}</span>
</Tooltip>
</Link>
{props.showVisibility && memo.visibility !== "PRIVATE" && ( {props.showVisibility && memo.visibility !== "PRIVATE" && (
<> <>
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" /> <Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
@ -316,6 +317,18 @@ const Memo: React.FC<Props> = (props: Props) => {
)} )}
</div> </div>
</div> </div>
{props.showParent && memo.parent && (
<div className="w-auto max-w-full mt-1">
<Link
className="px-2 py-0.5 border rounded-full max-w-xs w-auto text-xs flex flex-row justify-start items-center flex-nowrap text-gray-600 dark:text-gray-400 dark:border-gray-500 hover:shadow hover:opacity-80"
to={`/m/${memo.parent.id}`}
>
<Icon.ArrowUpRightFromCircle className="w-3 h-auto shrink-0 opacity-60" />
<span className="mx-1 opacity-60">#{memo.parent.id}</span>
<span className="truncate">{memo.parent.content}</span>
</Link>
</div>
)}
<MemoContent <MemoContent
content={memo.content} content={memo.content}
onMemoContentClick={handleMemoContentClick} onMemoContentClick={handleMemoContentClick}

@ -111,7 +111,7 @@ const MemoList: React.FC = () => {
<div className="flex flex-col justify-start items-start w-full max-w-full overflow-y-scroll pb-28 hide-scrollbar"> <div className="flex flex-col justify-start items-start w-full max-w-full overflow-y-scroll pb-28 hide-scrollbar">
<MemoFilter /> <MemoFilter />
{sortedMemos.map((memo) => ( {sortedMemos.map((memo) => (
<Memo key={memo.id} memo={memo} lazyRendering showVisibility showPinnedStyle /> <Memo key={memo.id} memo={memo} lazyRendering showVisibility showPinnedStyle showParent />
))} ))}
{loadingStatus === "fetching" ? ( {loadingStatus === "fetching" ? (

@ -83,7 +83,7 @@ const Explore = () => {
<div className="relative w-full h-auto flex flex-col justify-start items-start"> <div className="relative w-full h-auto flex flex-col justify-start items-start">
<MemoFilter /> <MemoFilter />
{sortedMemos.map((memo) => ( {sortedMemos.map((memo) => (
<Memo key={memo.id} memo={memo} lazyRendering showCreator /> <Memo key={memo.id} memo={memo} lazyRendering showCreator showParent />
))} ))}
{loadingStatus === "fetching" ? ( {loadingStatus === "fetching" ? (

Loading…
Cancel
Save