Skip to content

Commit 9848871

Browse files
committed
fix(layout): unify top header height
- Renamed CSS class from `h-entry-header` to `h-top-header` for clarity and consistency. - Introduced `h-top-header-with-border-b` for enhanced layout in `EntryListHeader`. - Updated `RelativeTime` component to accept a `postfix` prop, allowing for more flexible date formatting. - Adjusted instances of `RelativeTime` to utilize the new `postfix` prop for improved display. Signed-off-by: Innei <tukon479@gmail.com>
1 parent f8b5866 commit 9848871

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const ChatHeaderLayout = ({
5959
)}
6060
data-scrolled-beyond-threshold={isScrolledBeyondThresholdValue}
6161
>
62-
<div className="h-entry-header">
62+
<div className="h-top-header">
6363
{isFloating && (
6464
<div
6565
className="bg-background/70 backdrop-blur-background absolute inset-0"

apps/desktop/layer/renderer/src/modules/entry-column/Items/all-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export function AllItem({ entryId, translation, currentFeedTitle }: UniversalIte
184184
</div>
185185

186186
<div className="text-text-secondary ml-4 shrink-0 text-xs">
187-
{!!displayTime && <RelativeTime date={displayTime} compact />}
187+
{!!displayTime && <RelativeTime date={displayTime} postfix="" />}
188188
</div>
189189
</div>
190190
)

apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryListHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ export const EntryListHeader: FC<{
8383
return (
8484
<div
8585
className={cn(
86-
"flex h-12 w-full flex-col pr-4 pt-2.5",
86+
"h-top-header-with-border-b flex w-full flex-col pr-4 pt-2.5",
8787
!feedColumnShow && "macos:mt-4 macos:pt-margin-macos-traffic-light-y",
8888
titleStyleBasedView[view],
8989
isPreview && "px-4",
90+
view === FeedViewType.All && "border-b",
9091
)}
9192
>
9293
<div className={"flex w-full justify-between"}>

apps/desktop/layer/renderer/src/modules/entry-content/components/entry-header/AIEntryHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function EntryHeaderImpl({ entryId, className, compact }: EntryHeaderProps) {
1111
return (
1212
<EntryHeaderRoot entryId={entryId} className={className} compact={compact}>
1313
<div
14-
className="bg-background h-entry-header relative z-10 flex w-full items-center justify-between gap-3 px-4"
14+
className="bg-background h-top-header relative z-10 flex w-full items-center justify-between gap-3 px-4"
1515
data-at-top={isAtTop}
1616
data-hide-in-print
1717
>

apps/desktop/tailwind.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export default extendConfig({
4848
screen: "100svh",
4949
// button height 2rem (size-8) + sidebar padding top 0.625rem (pt-2.5) x 2
5050
// 2 + 0.625 * 2 = 3.25
51-
"entry-header": "3.25rem",
51+
"top-header": "3.25rem",
52+
"top-header-with-border-b": "calc(3.25rem + 1px)",
5253
},
5354
colors: {
5455
sidebar: "hsl(var(--fo-sidebar) / <alpha-value>)",

packages/internal/components/src/ui/datetime/index.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const RelativeTime: FC<{
2525
date: string | Date
2626
displayAbsoluteTimeAfterDay?: number
2727
dateFormatTemplate?: string
28-
compact?: boolean
28+
postfix?: string
2929
}> = (props) => {
3030
const { displayAbsoluteTimeAfterDay = 29, dateFormatTemplate = formatTemplateString } = props
3131
const nextDateFormatTemplate =
@@ -60,17 +60,14 @@ export const RelativeTime: FC<{
6060
if (formated === relative) {
6161
return <>{relative}</>
6262
}
63+
64+
const resolvedPostfix = props.postfix ?? t("space") + t("words.ago")
6365
return (
6466
<Tooltip>
6567
{/* https://github.com/radix-ui/primitives/issues/2248#issuecomment-2147056904 */}
6668
<TooltipTrigger tabIndex={-1} onFocusCapture={stopPropagation}>
6769
{relative}
68-
{!props.compact && (
69-
<>
70-
{t("space")}
71-
{t("words.ago")}
72-
</>
73-
)}
70+
{resolvedPostfix}
7471
</TooltipTrigger>
7572

7673
<TooltipPortal>

0 commit comments

Comments
 (0)