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

Function Comments

packages/dev/s2-docs/pages/s2/home/ExampleApp2.tsx:589–684  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

587}
588
589function Comments() {
590 let [comments, setComments] = useState([
591 {
592 author: 'Nikolas Gibbons',
593 avatar: 'https://www.untitledui.com/images/avatars/nikolas-gibbons',
594 date: '2 hours ago',
595 body: 'Thanks for the feedback!'
596 },
597 {
598 author: 'Adriana Sullivan',
599 avatar: 'https://www.untitledui.com/images/avatars/adriana-sullivan',
600 date: 'July 14',
601 body: 'Transitions are smooth! Could we speed them up just a bit?'
602 },
603 {
604 author: 'Frank Whitaker',
605 avatar: 'https://www.untitledui.com/images/avatars/frank-whitaker?',
606 date: 'July 13',
607 body: 'Love the direction. Could we simplify the header a bit more?'
608 }
609 ]);
610
611 return (
612 <div
613 role="group"
614 aria-label="Comments"
615 className={style({
616 display: 'flex',
617 flexDirection: 'column',
618 gap: 16,
619 padding: 16,
620 height: 'full',
621 boxSizing: 'border-box',
622 contain: 'size'
623 })}>
624 <h3
625 className={style({
626 font: 'title-lg',
627 color: {default: 'title', forcedColors: 'ButtonText'},
628 marginY: 0
629 })}>
630 Comments
631 </h3>
632 <form
633 className={style({
634 display: 'flex',
635 flexDirection: 'column',
636 gap: 8,
637 alignItems: 'end'
638 })}
639 onKeyDown={e => {
640 if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
641 e.currentTarget.requestSubmit();
642 }
643 }}
644 action={formData => {
645 setComments([
646 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected