MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Byline

Function Byline

packages/dev/s2-docs/src/typography.tsx:281–328  ·  view source on GitHub ↗
({
  author,
  authorLink,
  date
}: {
  author?: string;
  authorLink?: string;
  date: string;
})

Source from the content-addressed store, hash-verified

279}
280
281export function Byline({
282 author,
283 authorLink,
284 date
285}: {
286 author?: string;
287 authorLink?: string;
288 date: string;
289}) {
290 let formattedDate = new Date(date).toLocaleDateString('en-US', {
291 year: 'numeric',
292 month: 'long',
293 day: 'numeric'
294 });
295
296 return (
297 <div
298 className={style({
299 font: 'detail',
300 width: 'full',
301 maxWidth: '--text-width',
302 marginX: 'auto',
303 marginTop: 4
304 })}>
305 {author && (
306 <>
307 {'By '}
308 <span itemProp="author" itemScope itemType="https://schema.org/Person">
309 {authorLink ? (
310 <>
311 <meta itemProp="url" content={authorLink} />
312 <Link href={authorLink} isQuiet rel="author" target="_blank">
313 <span itemProp="name">{author}</span>
314 </Link>
315 </>
316 ) : (
317 <span itemProp="name">{author}</span>
318 )}
319 </span>
320 {' · '}
321 </>
322 )}
323 <time itemProp="datePublished" dateTime={date}>
324 {formattedDate}
325 </time>
326 </div>
327 );
328}
329
330export function Time({date}: {date: string}) {
331 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected