feat: update Image, ImageLink, ImageDisplay and ImageDisplayLink UI for v2 design#129
Open
andy19910102 wants to merge 7 commits intocoseeing:mainfrom
Open
feat: update Image, ImageLink, ImageDisplay and ImageDisplayLink UI for v2 design#129andy19910102 wants to merge 7 commits intocoseeing:mainfrom
andy19910102 wants to merge 7 commits intocoseeing:mainfrom
Conversation
wendyyuchensun
approved these changes
Apr 30, 2026
Collaborator
There was a problem hiding this comment.
功能看起來 OK,覺得可以先 merge。
看起來 <Tooltip /> 不太好用,這個我先記下來,會再另外 follow up 改善。
最後,覺得可以討論:withAltTooltip 和 withDisplayCaption prefer 改用 composition,這樣可以在 DevTools 中看到完整的元件樹、JSX 結構讀起來更直覺,也更容易在日後需要時加入 hooks。代價是程式碼會稍微冗長一些,但覺得以這個 project 的規模是可以接受的。
例如:
const ImageDisplay = ({ alt, display, source }) =>
withDisplayCaption(withAltTooltip(renderImg(source, alt), alt), display);composition:
const Img = ({ source, alt }) => (
<img src={source} alt={alt} className="block w-full" />
);
const AltTooltip = ({ alt, children }) => (
<span className="block overflow-hidden">
<Tooltip label={alt}>
<span className="block -mt-[15px] pt-[15px]">{children}</span>
</Tooltip>
</span>
);
const Caption = ({ display, children }) => (
<figure>
{children}
<figcaption className="mt-3 text-center text-base text-text-secondary">{display}</figcaption>
</figure>
);
const ImageDisplay = ({ alt, display, source }) => (
<Caption display={display}>
<AltTooltip alt={alt}>
<Img source={source} alt={alt} />
</AltTooltip>
</Caption>
);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solve #119