Repository navigation
style: card style - #7807
Merged
Merged
style: card style#7807
Conversation
shaohuzhang1
commented
Nov 10, 2026
| <span class="shrink-0">{{ dateFormat(props.create_time) }}</span> | ||
| </div> | ||
| </slot> | ||
| </div> |
Contributor
Author
There was a problem hiding this comment.
Review of the diff
Overall the change is reasonable: making the nickname the only shrinkable item and giving it truncate + a title tooltip is the standard way to stop a long nickname from pushing “创建于 / date” out of the container. A few things to tighten:
Potential issues
titledoesn’t work on touch devices. On mobile/tablet the truncated nickname becomes unreadable with no way to reveal it. Consider a tap-to-expand, a proper tooltip component, or allowing the name to wrap (e.g.line-clamp-2) under asm:breakpoint.- Tooltip shows even when not truncated.
titleis always present, so short names also get a redundant tooltip. Minor UX noise; only fixable with JS overflow detection, so may be acceptable. - Truncation only works if the ancestor chain is width-constrained.
min-w-0fixes the flex-itemmin-width:autoproblem on this<span>, but if the wrappingdiv.text-sm.text-N600(or its parent) is itself a flex/grid item, it also needsmin-w-0(oroverflow-hidden), otherwise the row will still overflow instead of ellipsizing. Worth verifying in the surrounding template. shrink-0on the date can cause overflow in very narrow containers. With both “创建于” and the date locked to their intrinsic width, a very narrow card can overflow horizontally; considerflex-wrapon the row or hiding the date at the smallest breakpoint.- Empty values still render. The outer
v-ifisslots.subtitle || create_time || nick_name, so if onlynick_nameexists you still render a dangling “创建于” with an empty/invalid date (dateFormat(undefined)). GuarddateFormatagainst falsy/invalid input, or conditionally render the “创建于 + date” pair. - Accessibility.
<span title>is not focusable, so keyboard and screen-reader users may not get the full value. If the full name matters, consider anaria-labelor a focusable disclosure. - Hunk header sanity.
@@ -94,9 +94,9 @@is consistent (3 context + 3 removed + 3 added on each side), so no diff-format problem.
Optimization suggestions
- Compute the formatted date once (
const formattedTime = computed(() => dateFormat(props.create_time))) rather than callingdateFormaton every render; also makes guarding invalid dates easier. - Drop the
props.prefix in the template if the component uses<script setup>—nick_nameandcreate_timeare directly accessible; it’s only cosmetic, but more idiomatic. "创建于"is hard-coded. Since the file is being touched anyway, consider moving it to i18n if the project supports it.truncateimpliesoverflow-hidden, which can clip focus rings/descenders on the span; if you later add interactivity there, useoverflow-hiddenon a wrapper instead.- Consider
flex-1 min-w-0 truncateif you want the nickname to consume the remaining space predictably;min-w-0 truncatealone already works, butflex-1makes the layout intent explicit. - If the nickname can be very long or contain leading/trailing whitespace,
:title="props.nick_name?.trim()"avoids odd tooltips.
Net
No functional bug introduced; the change is an improvement. The main real-world risks are (3) missing min-w-0 higher up the tree and (1) the tooltip being invisible on touch devices.
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.
style: card style