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

Function Byline

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

Source from the content-addressed store, hash-verified

72}
73
74export function Byline({
75 author,
76 authorLink,
77 date
78}: {
79 author?: string;
80 authorLink?: string;
81 date: string;
82}) {
83 let formattedDate = new Date(date).toLocaleDateString('en-US', {
84 year: 'numeric',
85 month: 'long',
86 day: 'numeric'
87 });
88
89 return (
90 <div
91 className={style({
92 font: 'detail',
93 width: 'full',
94 maxWidth: '--text-width',
95 marginX: 'auto',
96 marginTop: 4
97 })}>
98 {author && (
99 <>
100 {'By '}
101 <span itemProp="author" itemScope itemType="https://schema.org/Person">
102 {authorLink ? (
103 <>
104 <meta itemProp="url" content={authorLink} />
105 <Link href={authorLink} isQuiet rel="author" target="_blank">
106 <span itemProp="name">{author}</span>
107 </Link>
108 </>
109 ) : (
110 <span itemProp="name">{author}</span>
111 )}
112 </span>
113 {' · '}
114 </>
115 )}
116 <time itemProp="datePublished" dateTime={date}>
117 {formattedDate}
118 </time>
119 </div>
120 );
121}
122
123export function Time({date}: {date: string}) {
124 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected