app-ui / lists / feeds
Simple With Icons
01-simple-with-icons.jsx
import { CheckIcon, HandThumbUpIcon, UserIcon } from '@heroicons/react/20/solid'
const timeline = [
{
id: 1,
content: 'Applied to',
target: 'Front End Developer',
href: '#',
date: 'Sep 20',
datetime: '2020-09-20',
icon: UserIcon,
iconBackground: 'bg-gray-400 dark:bg-gray-600',
},
{
id: 2,
content: 'Advanced to phone screening by',
target: 'Bethany Blake',
href: '#',
date: 'Sep 22',
datetime: '2020-09-22',
icon: HandThumbUpIcon,
iconBackground: 'bg-blue-500',
},
{
id: 3,
content: 'Completed phone screening with',
target: 'Martha Gardner',
href: '#',
date: 'Sep 28',
datetime: '2020-09-28',
icon: CheckIcon,
iconBackground: 'bg-green-500',
},
{
id: 4,
content: 'Advanced to interview by',
target: 'Bethany Blake',
href: '#',
date: 'Sep 30',
datetime: '2020-09-30',
icon: HandThumbUpIcon,
iconBackground: 'bg-blue-500',
},
{
id: 5,
content: 'Completed interview with',
target: 'Katherine Snyder',
href: '#',
date: 'Oct 4',
datetime: '2020-10-04',
icon: CheckIcon,
iconBackground: 'bg-green-500',
},
]
function classNames(...classes) {
return classes.filter(Boolean).join(' ')
}
export default function Example() {
return (
<div className="flow-root">
<ul role="list" className="-mb-8">
{timeline.map((event, eventIdx) => (
<li key={event.id}>
<div className="relative pb-8">
{eventIdx !== timeline.length - 1 ? (
<span
aria-hidden="true"
className="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200 dark:bg-white/10"
/>
) : null}
<div className="relative flex space-x-3">
<div>
<span
className={classNames(
event.iconBackground,
'flex size-8 items-center justify-center rounded-full ring-8 ring-white dark:ring-gray-900',
)}
>
<event.icon aria-hidden="true" className="size-5 text-white" />
</span>
</div>
<div className="flex min-w-0 flex-1 justify-between space-x-4 pt-1.5">
<div>
<p className="text-sm text-gray-500 dark:text-gray-400">
{event.content}{' '}
<a href={event.href} className="font-medium text-gray-900 dark:text-white">
{event.target}
</a>
</p>
</div>
<div className="text-right text-sm whitespace-nowrap text-gray-500 dark:text-gray-400">
<time dateTime={event.datetime}>{event.date}</time>
</div>
</div>
</div>
</div>
</li>
))}
</ul>
</div>
)
}