Skip to content
← Public packages

@kentcdodds/photo-portfolio

A fast, photo-first portfolio site you update by chatting with your agent: galleries, about, contact, and one-step rollback.

FollowFork

Files

contact-links.tsx

48 lines · 1.2 KB · TypeScript
/** @jsxRuntime automatic */
/** @jsxImportSource remix/component */
import type { SiteConfig, SocialPlatform } from '../../src/domain/types.ts'
import { icon, socialLabels } from './icons.tsx'

/** Email, phone, booking, location, and social links (whichever are configured). */
export function contactLinks(config: SiteConfig) {
	const socials = Object.entries(config.social) as Array<
		[SocialPlatform, string]
	>
	return (
		<ul class="contact-links">
			<li>
				<a href={`mailto:${config.contactEmail}`}>
					{icon('mail')} {config.contactEmail}
				</a>
			</li>
			{config.phone ? (
				<li>
					<a href={`tel:${config.phone.replace(/[^\d+]/g, '')}`}>
						{icon('phone')} {config.phone}
					</a>
				</li>
			) : null}
			{config.bookingUrl ? (
				<li>
					<a href={config.bookingUrl} rel="noopener" target="_blank">
						{icon('calendar')} {config.bookingLabel}
					</a>
				</li>
			) : null}
			{config.location ? (
				<li>
					<span>
						{icon('pin')} {config.location}
					</span>
				</li>
			) : null}
			{socials.map(([platform, url]) => (
				<li>
					<a href={url} rel="me noopener" target="_blank">
						{icon('arrow')} {socialLabels[platform]}
					</a>
				</li>
			))}
		</ul>
	)
}