Skip to content

Commit 7b31362

Browse files
chore: update contents and fix responsivenes
1 parent 891ad23 commit 7b31362

File tree

27 files changed

+437
-441
lines changed

27 files changed

+437
-441
lines changed

apps/sim/app/(home)/components/features/features.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import Image from 'next/image'
66
import Link from 'next/link'
77
import { Badge, ChevronDown } from '@/components/emcn'
88
import { FeaturesPreview } from '@/app/(home)/components/features/components/features-preview'
9-
10-
function hexToRgba(hex: string, alpha: number): string {
11-
const r = Number.parseInt(hex.slice(1, 3), 16)
12-
const g = Number.parseInt(hex.slice(3, 5), 16)
13-
const b = Number.parseInt(hex.slice(5, 7), 16)
14-
return `rgba(${r},${g},${b},${alpha})`
15-
}
9+
import { hexToRgba } from '@/lib/core/utils/formatting'
1610

1711
const FEATURE_TABS = [
1812
{

apps/sim/app/(home)/components/templates/templates.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Badge, ChevronDown } from '@/components/emcn'
99
import { LandingWorkflowSeedStorage } from '@/lib/core/utils/browser-storage'
1010
import { cn } from '@/lib/core/utils/cn'
1111
import { TEMPLATE_WORKFLOWS } from '@/app/(home)/components/templates/template-workflows'
12+
import { hexToRgba } from '@/lib/core/utils/formatting'
1213

1314
const logger = createLogger('LandingTemplates')
1415

@@ -23,13 +24,6 @@ const LandingPreviewWorkflow = dynamic(
2324
}
2425
)
2526

26-
function hexToRgba(hex: string, alpha: number): string {
27-
const r = Number.parseInt(hex.slice(1, 3), 16)
28-
const g = Number.parseInt(hex.slice(3, 5), 16)
29-
const b = Number.parseInt(hex.slice(5, 7), 16)
30-
return `rgba(${r},${g},${b},${alpha})`
31-
}
32-
3327
const LEFT_WALL_CLIP = 'polygon(0 8px, 100% 0, 100% 100%, 0 100%)'
3428
const BOTTOM_WALL_CLIP = 'polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%)'
3529

@@ -412,7 +406,7 @@ export default function Templates() {
412406
ref={sectionRef}
413407
id='templates'
414408
aria-labelledby='templates-heading'
415-
className='mt-[40px] mb-[80px]'
409+
className='mt-[40px] mb-[80px] overflow-x-clip'
416410
>
417411
<p className='sr-only'>
418412
Sim includes {TEMPLATE_WORKFLOWS.length} pre-built workflow templates covering OCR
@@ -449,7 +443,7 @@ export default function Templates() {
449443
</svg>
450444
</div>
451445

452-
<div className='px-[20px] pt-[60px] lg:px-[80px] lg:pt-[100px]'>
446+
<div className='px-4 pt-[60px] sm:px-6 lg:px-[80px] lg:pt-[100px]'>
453447
<div className='flex flex-col items-start gap-[20px]'>
454448
<Badge
455449
variant='blue'
@@ -517,7 +511,7 @@ export default function Templates() {
517511
aria-controls={TEMPLATES_PANEL_ID}
518512
onClick={() => setActiveIndex(index)}
519513
className={cn(
520-
'relative w-full text-left',
514+
'relative w-full overflow-x-clip text-left',
521515
isActive
522516
? 'z-10'
523517
: cn(
@@ -543,7 +537,7 @@ export default function Templates() {
543537
className='absolute right-[-8px] bottom-0 left-2 h-2'
544538
style={buildBottomWallStyle(depth)}
545539
/>
546-
<div className='-translate-y-2 relative flex translate-x-2 items-center bg-[#242424] px-[12px] py-[10px] shadow-[inset_0_0_0_1.5px_#3E3E3E]'>
540+
<div className='-translate-y-2 relative flex w-full translate-x-2 items-center bg-[#242424] px-[12px] py-[10px] shadow-[inset_0_0_0_1.5px_#3E3E3E]'>
547541
<span className='flex-1 font-[430] font-season text-[16px] text-white'>
548542
{workflow.name}
549543
</span>

apps/sim/app/(landing)/blog/[slug]/article-sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function ArticleSidebar({ headings }: ArticleSidebarProps) {
88
if (headings.length === 0) return null
99

1010
return (
11-
<aside className='hidden w-full shrink-0 xl:sticky xl:top-[76px] xl:block xl:w-72 xl:pt-16 mr-2'>
11+
<aside className='mr-2 hidden w-full shrink-0 xl:sticky xl:top-[76px] xl:block xl:w-72 xl:pt-16'>
1212
<TableOfContents headings={headings} />
1313
</aside>
1414
)

apps/sim/app/(landing)/blog/[slug]/back-link.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export function BackLink() {
77
href='/blog'
88
className='group flex items-center gap-1 text-[#999] text-sm hover:text-[#ECECEC]'
99
>
10-
<span className='inline-flex transition-transform duration-200 group-hover:-translate-x-0.5'>
11-
<ChevronLeft className='h-4 w-4 block group-hover:hidden' aria-hidden='true' />
12-
<ArrowLeft className='h-4 w-4 hidden group-hover:block' aria-hidden='true' />
10+
<span className='group-hover:-translate-x-0.5 inline-flex transition-transform duration-200'>
11+
<ChevronLeft className='block h-4 w-4 group-hover:hidden' aria-hidden='true' />
12+
<ArrowLeft className='hidden h-4 w-4 group-hover:block' aria-hidden='true' />
1313
</span>
1414
Back to Blog
1515
</Link>

apps/sim/app/(landing)/blog/[slug]/page.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ export default async function Page({ params }: { params: Promise<{ slug: string
5252
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbLd) }}
5353
/>
5454

55-
<div className='mx-auto flex w-full max-w-[1500px] flex-col items-start gap-2 pb-24 pt-16 xl:flex-row'>
56-
<div data-blog-main-content className='max-w-5xl flex-grow mx-auto'>
55+
<div className='mx-auto flex w-full max-w-[1500px] flex-col items-start gap-8 px-4 pt-10 pb-24 sm:px-6 sm:pt-12 lg:px-8 lg:pt-16 xl:flex-row xl:gap-12'>
56+
<div data-blog-main-content className='mx-auto w-full min-w-0 max-w-5xl flex-grow'>
5757
<Link
5858
href='/blog'
59-
className='group mb-8 inline-flex items-center gap-2 border border-[#2A2A2A] bg-[#232323] px-4 py-2 font-season text-[11px] uppercase tracking-widest text-[#999] transition-colors hover:text-[#ECECEC]'
59+
className='group mb-8 inline-flex items-center gap-2 border border-[#2A2A2A] bg-[#232323] px-4 py-2 font-season text-[#999] text-[11px] uppercase tracking-widest transition-colors hover:text-[#ECECEC]'
6060
style={{ borderRadius: '5px' }}
6161
>
6262
<ArrowLeft
63-
className='h-3 w-3 transition-transform group-hover:-translate-x-1'
63+
className='group-hover:-translate-x-1 h-3 w-3 transition-transform'
6464
aria-hidden='true'
6565
/>
6666
All Posts
6767
</Link>
68-
<header className='mb-12 border-b border-[#2A2A2A] pb-8'>
68+
<header className='mb-12 border-[#2A2A2A] border-b pb-8'>
6969
<ArticleHeaderMotion>
7070
<ArticleHeaderItem className='mb-6 flex w-full flex-col gap-4 sm:flex-row sm:items-center sm:justify-between'>
7171
<div className='flex items-center gap-3'>
@@ -74,7 +74,7 @@ export default async function Page({ params }: { params: Promise<{ slug: string
7474
style={{ backgroundColor: categoryColor }}
7575
aria-hidden='true'
7676
/>
77-
<div className='font-season text-[11px] uppercase tracking-widest text-[#999]'>
77+
<div className='font-season text-[#999] text-[11px] uppercase tracking-widest'>
7878
<time dateTime={post.date} itemProp='datePublished'>
7979
{new Date(post.date).toLocaleDateString('en-US', {
8080
month: 'short',
@@ -87,27 +87,27 @@ export default async function Page({ params }: { params: Promise<{ slug: string
8787
</div>
8888
</div>
8989

90-
<div className='shrink-0'>
90+
<div className='shrink-0 self-start sm:self-auto'>
9191
<ShareButtons url={shareUrl} title={post.title} />
9292
</div>
9393
</ArticleHeaderItem>
9494
<ArticleHeaderItem>
9595
<h1
96-
className='mb-6 font-[500] text-[36px] leading-[1.15] tracking-tight text-[#ECECEC] sm:text-[40px] md:text-[48px]'
96+
className='mb-6 font-[500] text-[#ECECEC] text-[36px] leading-[1.15] tracking-tight sm:text-[40px] md:text-[48px]'
9797
itemProp='headline'
9898
>
9999
{post.title}
100100
</h1>
101101
</ArticleHeaderItem>
102102
<ArticleHeaderItem>
103-
<p className='mb-6 text-[18px] leading-relaxed text-[#999]' itemProp='description'>
103+
<p className='mb-6 text-[#999] text-[18px] leading-relaxed' itemProp='description'>
104104
{post.description}
105105
</p>
106106
</ArticleHeaderItem>
107107

108108
{post.tags.length > 0 && (
109109
<ArticleHeaderItem>
110-
<div className='flex flex-wrap items-center gap-x-1.5 gap-y-1 font-season text-[11px] text-[#666]'>
110+
<div className='flex flex-wrap items-center gap-x-1.5 gap-y-1 font-season text-[#666] text-[11px]'>
111111
{post.tags.map((tag, i) => (
112112
<span key={tag}>
113113
<Link
@@ -165,7 +165,7 @@ interface ArticleAuthorsProps {
165165
function ArticleAuthors({ authors }: ArticleAuthorsProps) {
166166
return (
167167
<div className='mt-12'>
168-
<div className='mb-6 flex items-center gap-2 font-season text-[11px] uppercase tracking-widest text-[#666]'>
168+
<div className='mb-6 flex items-center gap-2 font-season text-[#666] text-[11px] uppercase tracking-widest'>
169169
<span className='inline-block h-2 w-2 bg-[#FA4EDF]' aria-hidden='true' />
170170
{authors.length > 1 ? 'Authors' : 'Written by'}
171171
</div>
@@ -177,7 +177,7 @@ function ArticleAuthors({ authors }: ArticleAuthorsProps) {
177177
style={{ borderRadius: '2px' }}
178178
>
179179
<div
180-
className='flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden border border-[#2A2A2A] bg-[#1C1C1C] font-season text-lg text-[#2ABBF8]'
180+
className='flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden border border-[#2A2A2A] bg-[#1C1C1C] font-season text-[#2ABBF8] text-lg'
181181
style={{ borderRadius: '2px' }}
182182
>
183183
{a.avatarUrl ? (
@@ -200,7 +200,7 @@ function ArticleAuthors({ authors }: ArticleAuthorsProps) {
200200
href={a.url}
201201
target='_blank'
202202
rel='noopener noreferrer'
203-
className='font-season text-[11px] text-[#999] transition-colors hover:text-[#ECECEC]'
203+
className='font-season text-[#999] text-[11px] transition-colors hover:text-[#ECECEC]'
204204
>
205205
{a.xHandle ? `@${a.xHandle}` : 'Profile'}
206206
</Link>
@@ -219,8 +219,8 @@ interface RelatedArticlesProps {
219219

220220
function RelatedArticles({ posts }: RelatedArticlesProps) {
221221
return (
222-
<div className='mt-12 border-t border-[#2A2A2A] pt-8'>
223-
<div className='mb-6 flex items-center gap-2 font-season text-[11px] uppercase tracking-widest text-[#666]'>
222+
<div className='mt-12 border-[#2A2A2A] border-t pt-8'>
223+
<div className='mb-6 flex items-center gap-2 font-season text-[#666] text-[11px] uppercase tracking-widest'>
224224
<span className='inline-block h-2 w-2 bg-[#FFCC02]' aria-hidden='true' />
225225
Related articles
226226
</div>
@@ -232,24 +232,24 @@ function RelatedArticles({ posts }: RelatedArticlesProps) {
232232
<Link
233233
key={p.slug}
234234
href={`/blog/${p.slug}`}
235-
className='group flex flex-col border border-[#2A2A2A] bg-[#232323] p-5 transition-[border-color,background-color,transform] duration-200 ease-out [@media(hover:hover)]:hover:border-[#3d3d3d] [@media(hover:hover)]:hover:bg-[#282828] [@media(hover:hover)]:hover:-translate-y-0.5'
235+
className='group [@media(hover:hover)]:hover:-translate-y-0.5 flex flex-col border border-[#2A2A2A] bg-[#232323] p-5 transition-[border-color,background-color,transform] duration-200 ease-out [@media(hover:hover)]:hover:border-[#3d3d3d] [@media(hover:hover)]:hover:bg-[#282828]'
236236
style={{ borderRadius: '2px' }}
237237
>
238238
<div className='mb-3 flex items-center gap-3'>
239239
<span
240-
className='inline-block px-2 py-0.5 font-season text-[10px] font-bold uppercase tracking-wider text-black'
240+
className='inline-block px-2 py-0.5 font-bold font-season text-[10px] text-black uppercase tracking-wider'
241241
style={{ backgroundColor: color }}
242242
>
243243
{cat.label}
244244
</span>
245245
</div>
246-
<h4 className='mb-2 text-[15px] font-[500] leading-tight text-[#ECECEC] transition-colors duration-150 [@media(hover:hover)]:group-hover:text-[#FFCC02]'>
246+
<h4 className='mb-2 font-[500] text-[#ECECEC] text-[15px] leading-tight transition-colors duration-150 [@media(hover:hover)]:group-hover:text-[#FFCC02]'>
247247
{p.title}
248248
</h4>
249-
<p className='mb-4 line-clamp-2 text-[13px] leading-relaxed text-[#999]'>
249+
<p className='mb-4 line-clamp-2 text-[#999] text-[13px] leading-relaxed'>
250250
{p.description}
251251
</p>
252-
<div className='mt-auto font-season text-[10px] text-[#666]'>
252+
<div className='mt-auto font-season text-[#666] text-[10px]'>
253253
{formatDate(new Date(p.date))}
254254
</div>
255255
</Link>

apps/sim/app/(landing)/blog/[slug]/table-of-contents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ export function TableOfContents({ headings }: TableOfContentsProps) {
498498
<nav
499499
ref={navRef}
500500
className='flex w-[250px] flex-col'
501-
aria-label='Table of contents'
501+
aria-label='On this page'
502502
onPointerMove={onPointerMove}
503503
onPointerLeave={onPointerLeave}
504504
>
@@ -540,7 +540,7 @@ function TocOverline() {
540540
/>
541541
</div>
542542
<span className='font-medium font-season text-[#FFFFFF] text-[10px] uppercase leading-none tracking-[0.28em] transition-colors duration-150 ease-out group-hover:text-[#A1A1A1]'>
543-
Table of Contents
543+
On this page
544544
</span>
545545
</button>
546546
)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use client'
2+
3+
import { useCallback, useMemo, useState } from 'react'
4+
import { useRouter } from 'next/navigation'
5+
import { BlogStudioSidebar } from '@/app/(landing)/blog/studio-sidebar-client'
6+
7+
interface AuthorWithSidebarProps {
8+
allPosts: { tags: string[] }[]
9+
activeTag: string | null
10+
children: React.ReactNode
11+
}
12+
13+
export function AuthorWithSidebar({ allPosts, activeTag, children }: AuthorWithSidebarProps) {
14+
const router = useRouter()
15+
const [query, setQuery] = useState('')
16+
17+
const handleChangeQuery = useCallback(
18+
(value: string) => {
19+
setQuery(value)
20+
const trimmed = value.trim()
21+
router.push(trimmed ? `/blog?q=${encodeURIComponent(trimmed)}` : '/blog')
22+
},
23+
[router]
24+
)
25+
26+
const handleSelectTag = useCallback(
27+
(id: string | null) => {
28+
setQuery('')
29+
router.push(id ? `/blog?tag=${encodeURIComponent(id)}` : '/blog')
30+
},
31+
[router]
32+
)
33+
34+
const sidebarPosts = useMemo(() => allPosts.map((p) => ({ tags: p.tags })), [allPosts])
35+
36+
return (
37+
<div className='flex min-h-0 flex-1 flex-col overflow-x-clip px-4 sm:px-6 lg:flex-row lg:px-12'>
38+
<BlogStudioSidebar
39+
posts={sidebarPosts}
40+
activeTag={activeTag}
41+
query={query}
42+
onChangeQuery={handleChangeQuery}
43+
onSelectTag={handleSelectTag}
44+
/>
45+
<main className='relative min-w-0 flex-1'>{children}</main>
46+
</div>
47+
)
48+
}

apps/sim/app/(landing)/blog/authors/[id]/page.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { Metadata } from 'next'
22
import Image from 'next/image'
33
import Link from 'next/link'
44
import { getAllPostMeta } from '@/lib/blog/registry'
5+
import { AuthorWithSidebar } from '@/app/(landing)/blog/authors/[id]/author-with-sidebar'
56
import { PostGrid } from '@/app/(landing)/blog/post-grid'
6-
import { WithSidebar } from '@/app/(landing)/blog/with-sidebar'
77

88
function findAuthorById(posts: Awaited<ReturnType<typeof getAllPostMeta>>, id: string) {
99
for (const p of posts) {
@@ -25,19 +25,26 @@ export async function generateMetadata({
2525
return { title: author?.name ?? 'Author' }
2626
}
2727

28-
export default async function AuthorPage({ params }: { params: Promise<{ id: string }> }) {
28+
export default async function AuthorPage({
29+
params,
30+
searchParams,
31+
}: {
32+
params: Promise<{ id: string }>
33+
searchParams: Promise<{ tag?: string; q?: string }>
34+
}) {
2935
const { id } = await params
36+
const { tag } = await searchParams
3037
const allPosts = await getAllPostMeta()
3138
const posts = allPosts.filter((p) => p.author.id === id || p.authors?.some((a) => a.id === id))
3239
const author = findAuthorById(allPosts, id)
3340

3441
if (!author) {
3542
return (
3643
<div className='mx-auto max-w-5xl px-8 py-16 lg:px-12'>
37-
<h1 className='font-[500] text-[32px] text-[#ECECEC]'>Author not found</h1>
44+
<h1 className='font-[500] text-[#ECECEC] text-[32px]'>Author not found</h1>
3845
<Link
3946
href='/blog'
40-
className='mt-4 inline-block font-season text-[12px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
47+
className='mt-4 inline-block font-season text-[#999] text-[12px] uppercase tracking-wider transition-colors hover:text-[#ECECEC]'
4148
>
4249
Back to all posts
4350
</Link>
@@ -55,8 +62,8 @@ export default async function AuthorPage({ params }: { params: Promise<{ id: str
5562
}
5663

5764
return (
58-
<WithSidebar>
59-
<div className='mx-auto max-w-5xl px-8 py-16 lg:px-12'>
65+
<AuthorWithSidebar allPosts={allPosts} activeTag={tag ?? null}>
66+
<div className='mx-auto w-full max-w-5xl px-4 py-16 sm:px-0 lg:mr-8 lg:px-0 lg:py-16'>
6067
<script
6168
type='application/ld+json'
6269
dangerouslySetInnerHTML={{ __html: JSON.stringify(personJsonLd) }}
@@ -78,31 +85,31 @@ export default async function AuthorPage({ params }: { params: Promise<{ id: str
7885
</div>
7986
)}
8087
<div>
81-
<div className='mb-1 font-season text-[10px] uppercase tracking-widest text-[#FA4EDF]'>
88+
<div className='mb-1 font-season text-[#FA4EDF] text-[10px] uppercase tracking-widest'>
8289
Author
8390
</div>
84-
<h1 className='font-[500] text-[32px] leading-tight tracking-[-0.02em] text-[#ECECEC]'>
91+
<h1 className='font-[500] text-[#ECECEC] text-[32px] leading-tight tracking-[-0.02em]'>
8592
{author.name}
8693
</h1>
8794
{author.url && (
8895
<Link
8996
href={author.url}
9097
target='_blank'
9198
rel='noopener noreferrer'
92-
className='font-season text-[11px] text-[#999] transition-colors hover:text-[#ECECEC]'
99+
className='font-season text-[#999] text-[11px] transition-colors hover:text-[#ECECEC]'
93100
>
94101
{author.xHandle ? `@${author.xHandle}` : 'Profile'}
95102
</Link>
96103
)}
97104
</div>
98105
</div>
99-
<h2 className='mb-8 flex items-center gap-2 font-season text-[11px] uppercase tracking-widest text-[#666]'>
106+
<h2 className='mb-8 flex items-center gap-2 font-season text-[#666] text-[11px] uppercase tracking-widest'>
100107
<span className='inline-block h-2 w-2 bg-[#00F701]' aria-hidden='true' />
101108
Posts by {author.name}
102109
</h2>
103110

104111
<PostGrid posts={posts} />
105112
</div>
106-
</WithSidebar>
113+
</AuthorWithSidebar>
107114
)
108115
}

0 commit comments

Comments
 (0)