Skip to content

Commit 7da8f94

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
improvement(ui): share product page heading recipe
1 parent 1fa912f commit 7da8f94

6 files changed

Lines changed: 18 additions & 10 deletions

File tree

‎apps/sim/app/o/[organizationId]/home/organization-home.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useCallback, useEffect, useState, useSyncExternalStore } from 'react'
4-
import { toast } from '@sim/emcn'
4+
import { cn, pageHeadingClassName, toast } from '@sim/emcn'
55
import { useQueryClient } from '@tanstack/react-query'
66
import Link from 'next/link'
77
import { useQueryStates } from 'nuqs'
@@ -382,7 +382,7 @@ function OrganizationHomeContent({
382382
<div className='min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]'>
383383
{/* Asymmetric padding biases the group up so the full cluster (heading + input + steps) sits at the optical center */}
384384
<div className='flex min-h-full flex-col items-center justify-center px-6 pt-[2vh] pb-[22vh]'>
385-
<h1 className='mb-7 max-w-chat text-balance font-season text-[26px] text-[var(--text-primary)] leading-[1.15] tracking-[-0.01em] sm:text-[28px]'>
385+
<h1 className={cn(pageHeadingClassName, 'mb-7 max-w-chat')}>
386386
{requestMode === 'assistant'
387387
? `Search ${organization.name}`
388388
: requestMode === 'plan'

‎apps/sim/app/o/[organizationId]/search/search-results-view.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { type ReactNode, useRef } from 'react'
2-
import { cn, scrollFadeAttributes, scrollFadeClass, useScrollEdges } from '@sim/emcn'
2+
import {
3+
cn,
4+
pageHeadingClassName,
5+
scrollFadeAttributes,
6+
scrollFadeClass,
7+
useScrollEdges,
8+
} from '@sim/emcn'
39
import { HEADER_ACTION_CLUSTER, PAGE_HEADER_BAR } from '@/components/page-header-bar'
410
import type { WorkspaceSearchFilters } from '@/lib/api/contracts/knowledge'
511
import type { SearchResource } from '@/lib/mothership/generated/resources'
@@ -70,7 +76,7 @@ export function SearchResultsView({
7076
<div className='min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]'>
7177
{/* Asymmetric padding biases the group up so heading and field sit at the optical center, as on Home */}
7278
<div className='flex min-h-full flex-col items-center justify-center px-6 pt-[2vh] pb-[22vh]'>
73-
<h1 className='mb-7 max-w-chat text-balance font-season text-[26px] text-[var(--text-primary)] leading-[1.15] tracking-[-0.01em] sm:text-[28px]'>
79+
<h1 className={cn(pageHeadingClassName, 'mb-7 max-w-chat')}>
7480
Search {organization.name}
7581
</h1>
7682
<div className='w-full max-w-chat'>{composer}</div>

‎apps/sim/app/workspace/[workspaceId]/components/error/error.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { type ReactNode, useEffect } from 'react'
4-
import { Chip } from '@sim/emcn'
4+
import { Chip, pageHeadingClassName } from '@sim/emcn'
55
import { TriangleAlert } from '@sim/emcn/icons'
66
import { createLogger } from '@sim/logger'
77

@@ -43,9 +43,7 @@ export function ErrorShell({ title, description, icon, children }: ErrorShellPro
4343
</div>
4444
</div>
4545
<div className='flex flex-col items-center gap-2'>
46-
<h2 className='text-balance font-season text-[26px] text-[var(--text-primary)] leading-[1.15] tracking-[-0.01em] sm:text-[28px]'>
47-
{title}
48-
</h2>
46+
<h2 className={pageHeadingClassName}>{title}</h2>
4947
<p className='max-w-[340px] text-[14px] text-[var(--text-tertiary)] leading-[1.55]'>
5048
{description}
5149
</p>

‎apps/sim/app/workspace/[workspaceId]/home/home.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useCallback, useEffect, useRef, useState } from 'react'
4-
import { cn, toast } from '@sim/emcn'
4+
import { cn, pageHeadingClassName, toast } from '@sim/emcn'
55
import { createLogger } from '@sim/logger'
66
import { useQueryClient } from '@tanstack/react-query'
77
import { useParams } from 'next/navigation'
@@ -434,7 +434,7 @@ function HomeContent({ chatId, userName, userId }: HomeProps) {
434434
<div className='h-full overflow-y-auto [scrollbar-gutter:stable_both-edges]'>
435435
{/* Asymmetric padding biases the group up so the full cluster (heading + input + suggestions) sits at the optical center */}
436436
<div className='flex min-h-full flex-col items-center justify-center px-6 pt-[2vh] pb-[22vh]'>
437-
<h1 className='mb-7 max-w-chat text-balance font-season text-[26px] text-[var(--text-primary)] leading-[1.15] tracking-[-0.01em] sm:text-[28px]'>
437+
<h1 className={cn(pageHeadingClassName, 'mb-7 max-w-chat')}>
438438
What should we get done{firstName ? `, ${firstName}` : ''}?
439439
</h1>
440440
<div ref={initialViewInputRef} className='relative w-full max-w-chat'>

‎packages/emcn/src/components/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export {
197197
overflowTextClipClass,
198198
overflowTextFadeClass,
199199
} from './overflow-text/overflow-text'
200+
export { pageHeadingClassName } from './page-heading/page-heading'
200201
export {
201202
Popover,
202203
PopoverAnchor,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/** Typography shared by the centered product page and error headings. */
2+
export const pageHeadingClassName =
3+
'text-balance font-season text-[26px] text-[var(--text-primary)] leading-[1.15] tracking-[-0.01em] sm:text-[28px]'

0 commit comments

Comments
 (0)