Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
feat: messages#174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
feat: messages #174
Changes from all commits
ff3ce93271b7a8edaf1439063fdb1b681847f6cc93f185544f19342cd043b8810f0fdfc6012323d77da0b913a12File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import type { ComponentProps } from 'svelte'; | ||
| import { ChatMessage } from '..'; | ||
| export default { | ||
| title: 'UI/ChatMessage', | ||
| component: ChatMessage, | ||
| tags: ['autodocs'], | ||
| render: (args: { Component: ChatMessage; props: ComponentProps<typeof ChatMessage> }) => ({ | ||
| Component: ChatMessage, | ||
| props: args | ||
| }) | ||
| }; | ||
| export const Outgoing = { | ||
| args: { | ||
| isOwn: true | ||
| } | ||
| }; | ||
| export const Incoming = { | ||
| args: { | ||
| isOwn: false, | ||
| message: | ||
| 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sed voluptatem accusantium voluptas vel, libero minus veniam at! Doloribus autem, id, ipsum laudantium dolor blanditiis nulla eum eveniet illo perspiciatis iusto.Voluptas ea pariatur eveniet quidem incidunt vitae sunt, hic labore nisi officiis consectetur autem odio repellendus nesciunt quisquam alias consequatur corrupti quaerat, minus qui. Obcaecati deleniti optio quod quibusdam placeat.' | ||
| } | ||
| }; | ||
| export const OutgoingWithoutHead = { | ||
| args: { | ||
| isOwn: true, | ||
| isHeadNeeded: false | ||
| } | ||
| }; | ||
| export const WithoutHead = { | ||
| args: { | ||
| isOwn: false, | ||
| isHeadNeeded: false, | ||
| message: | ||
| 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sed voluptatem accusantium voluptas vel, libero minus veniam at! Doloribus autem, id, ipsum laudantium dolor blanditiis nulla eum eveniet illo perspiciatis iusto.Voluptas ea pariatur eveniet quidem incidunt vitae sunt, hic labore nisi officiis consectetur autem odio repellendus nesciunt quisquam alias consequatur corrupti quaerat, minus qui. Obcaecati deleniti optio quod quibusdam placeat.' | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <script lang="ts"> | ||
| import { Avatar } from '$lib/ui'; | ||
| import { cn } from '$lib/utils'; | ||
| import type { HTMLAttributes } from 'svelte/elements'; | ||
| interface IChatMessageProps extends HTMLAttributes<HTMLElement> { | ||
| userImgSrc: string; | ||
| message: string; | ||
| time: string; | ||
| isOwn: boolean; | ||
| isHeadNeeded?: boolean; | ||
| } | ||
| let { | ||
| userImgSrc = 'https://picsum.photos/id/237/200/300', | ||
| message = 'i was thinking maybe like 12th?', | ||
| time = '12:55 AM', | ||
| isOwn, | ||
| isHeadNeeded = true, | ||
| ...restProps | ||
| }: IChatMessageProps = $props(); | ||
| </script> | ||
| <div | ||
| {...restProps} | ||
| class={cn( | ||
| [`flex items-start gap-2 ${isOwn ? 'flex' : 'flex-row-reverse'}`, restProps.class].join(' ') | ||
This conversation was marked as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| )} | ||
| > | ||
| <div class="w-8 flex-shrink-0"> | ||
| {#if isHeadNeeded} | ||
| <Avatar size="xs" src={userImgSrc} /> | ||
| {/if} | ||
This conversation was marked as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| </div> | ||
| <div class={cn(`max-w-[50%] ${isHeadNeeded ? 'mt-4' : 'mt-0'}`)}> | ||
| <div | ||
| class={cn( | ||
| `relative rounded-3xl px-4 py-2 ${isOwn ? 'bg-grey' : 'bg-brand-burnt-orange'}` | ||
| )} | ||
| > | ||
| {#if isHeadNeeded} | ||
| <svg | ||
| class={`absolute ${isOwn ? 'start-[-5px] top-[-2px]' : 'end-[-5px] top-[2px]'}`} | ||
| width="22" | ||
| height="17" | ||
| viewBox="0 0 22 17" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M0 0C5.79116 4.95613 8.40437 9.60298 10 17L22 2C11 2.5 7.53377 0.634763 0 0Z" | ||
| fill={isOwn ? '#F5F5F5' : 'var(--color-brand-burnt-orange)'} | ||
| /> | ||
| </svg> | ||
| {/if} | ||
| <p class={cn(`${!isOwn ? 'text-white' : 'text-black-600'}`)}> | ||
| {message} | ||
| </p> | ||
| </div> | ||
| <p | ||
| class={cn( | ||
| `subtext text-black-400 mt-0.5 flex text-xs text-nowrap ${ | ||
| isOwn ? 'justify-end' : 'justify-start' | ||
| }` | ||
| )} | ||
| > | ||
| {time} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -26,7 +26,7 @@ | ||
| <button | ||
| {...restProps} | ||
| class={cn([ | ||
| 'relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-4 hover:bg-gray-100', | ||
| 'relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-4', | ||
| restProps.class | ||
| ])} | ||
This conversation was marked as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| onclick={callback} | ||
| @@ -39,7 +39,7 @@ | ||
| <span class="h-2 w-2 rounded-full bg-blue-500"></span> | ||
| {/if} | ||
| </span> | ||
| <p class="text-black/60">{messageText}</p> | ||
| <p class="text-start text-black/60">{messageText}</p> | ||
| </span> | ||
| </button> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,29 @@ | ||
| <script lang="ts"> | ||
| import { goto } from '$app/navigation'; | ||
| import { Message } from '$lib/fragments'; | ||
| import { Input } from '$lib/ui'; | ||
| let searchValue = $state(''); | ||
| </script> | ||
| <section> | ||
| <Input type="text" bind:value={searchValue} placeholder="Search Messages" class="my-6" /> | ||
| {#each { length: 6 } as _, i} | ||
| <Message | ||
| class="mb-6" | ||
| avatar="https://www.gravatar.com/avatar/2c7d99fe281ecd3bcd65ab915bac6dd5?s=250" | ||
| username="donaldthefirstt" | ||
| text="i was thinking of making it to the conference so we could take some more fire pictures like last time" | ||
| unread={false} | ||
| callback={() => goto(`/messages/${i}`)} | ||
| /> | ||
| <Message | ||
| class="mb-6" | ||
| avatar="https://www.gravatar.com/avatar/2c7d99fe281ecd3bcd65ab915bac6dd5?s=250" | ||
| username="donaldthefirstt" | ||
| text="i was thinking of making it to the conference so we could take some more fire pictures like last time" | ||
| unread={true} | ||
| callback={() => goto(`/messages/${i}`)} | ||
| /> | ||
| {/each} | ||
| </section> |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.