-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Demian Parkhomenko <[email protected]>
- Loading branch information
1 parent
d4e8038
commit cfac283
Showing
1 changed file
with
17 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
'use client' | ||
|
||
import { useEffect, useState } from 'react' | ||
import Message from '@/components/message' | ||
|
||
export default function Home() { | ||
const [timeStamp, setTimeStamp] = useState(0) | ||
|
||
useEffect(() => { | ||
setTimeStamp(Date.now()) | ||
}, []) | ||
const now = Date.now() | ||
const MOCK_MESSAGES = [ | ||
{ sentAt: now - 1000 * 60 * 30, content: `...` }, | ||
{ sentAt: now - 1000 * 60 * 20, content: `I\'m not empty` }, | ||
{ sentAt: now - 1000 * 60 * 10, content: `Hello, i\'m a message! 😎` }, | ||
{ | ||
sentAt: now, | ||
content: | ||
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Id, porro', | ||
}, | ||
] | ||
|
||
export default function Home() { | ||
return ( | ||
<main className="flex flex-col gap-3 p-3"> | ||
<Message sentAt={timeStamp}> | ||
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quae | ||
architecto quis iure ex id voluptatum reprehenderit quod cum laboriosam. | ||
Dicta temporibus quis sed assumenda tempore perferendis voluptas magnam | ||
minima dignissimos! Dignissimos porro ea incidunt quae blanditiis, | ||
exercitationem deserunt beatae omnis temporibus officiis, consequatur | ||
nulla accusamus commodi officia minus, ullam unde optio nisi similique | ||
ab maiores? Perferendis aliquid minus laudantium error. | ||
</Message> | ||
<Message sentAt={timeStamp}>Hello, i'm a message! 😎</Message> | ||
<Message sentAt={timeStamp}>I'm not empty</Message> | ||
<Message sentAt={timeStamp}>...</Message> | ||
{MOCK_MESSAGES.map(({ sentAt, content }, i) => ( | ||
<Message key={i} sentAt={sentAt}> | ||
{content} | ||
</Message> | ||
))} | ||
</main> | ||
) | ||
} |