Selected dialog styles
This commit is contained in:
parent
ff988b1678
commit
0c975c9860
|
@ -9,7 +9,7 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&:hover {
|
&.hovered:hover {
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,4 +69,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.opened,
|
||||||
|
&.opened:hover {
|
||||||
|
background: #000;
|
||||||
|
.name,
|
||||||
|
.message,
|
||||||
|
.time {
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ type DialogProps = {
|
||||||
onClick?: () => void
|
onClick?: () => void
|
||||||
isChatHeader?: boolean
|
isChatHeader?: boolean
|
||||||
lastUpdate?: number
|
lastUpdate?: number
|
||||||
|
isOpened?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const DialogCard = (props: DialogProps) => {
|
const DialogCard = (props: DialogProps) => {
|
||||||
|
@ -27,10 +28,16 @@ const DialogCard = (props: DialogProps) => {
|
||||||
?.map((companion) => companion.name)
|
?.map((companion) => companion.name)
|
||||||
.join(', ')
|
.join(', ')
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show when={props.members}>
|
<Show when={props.members}>
|
||||||
<div class={clsx(styles.DialogCard, { [styles.header]: props.isChatHeader })} onClick={props.onClick}>
|
<div
|
||||||
|
class={clsx(styles.DialogCard, {
|
||||||
|
[styles.header]: props.isChatHeader,
|
||||||
|
[styles.opened]: props.isOpened,
|
||||||
|
[styles.hovered]: !props.isChatHeader
|
||||||
|
})}
|
||||||
|
onClick={props.onClick}
|
||||||
|
>
|
||||||
<div class={styles.avatar}>
|
<div class={styles.avatar}>
|
||||||
<Switch fallback={<DialogAvatar name={props.members[0].name} url={props.members[0].userpic} />}>
|
<Switch fallback={<DialogAvatar name={props.members[0].name} url={props.members[0].userpic} />}>
|
||||||
<Match when={companions().length > 2}>
|
<Match when={companions().length > 2}>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin: 3.2rem 0;
|
margin: 3.2rem 0;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import styles from './Message.module.scss'
|
||||||
import DialogAvatar from './DialogAvatar'
|
import DialogAvatar from './DialogAvatar'
|
||||||
import type { Message, ChatMember } from '../../graphql/types.gen'
|
import type { Message, ChatMember } from '../../graphql/types.gen'
|
||||||
import formattedTime from '../../utils/formatDateTime'
|
import formattedTime from '../../utils/formatDateTime'
|
||||||
|
import { Icon } from '../_shared/Icon'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
content: Message
|
content: Message
|
||||||
|
@ -17,11 +18,13 @@ const md = new MarkdownIt({
|
||||||
})
|
})
|
||||||
|
|
||||||
const Message = (props: Props) => {
|
const Message = (props: Props) => {
|
||||||
// возвращать ID автора
|
|
||||||
const isOwn = props.ownId === Number(props.content.author)
|
const isOwn = props.ownId === Number(props.content.author)
|
||||||
const user = props.members?.find((m) => m.id === Number(props.content.author))
|
const user = props.members?.find((m) => m.id === Number(props.content.author))
|
||||||
return (
|
return (
|
||||||
<div class={clsx(styles.Message, isOwn && styles.own)}>
|
<div class={clsx(styles.Message, isOwn && styles.own)}>
|
||||||
|
{/*<div class={styles.actions}>*/}
|
||||||
|
{/* /!*<Icon name={}></Icon>*!/*/}
|
||||||
|
{/*</div>*/}
|
||||||
<Show when={!isOwn}>
|
<Show when={!isOwn}>
|
||||||
<div class={styles.author}>
|
<div class={styles.author}>
|
||||||
<DialogAvatar size="small" name={user.name} url={user.userpic} />
|
<DialogAvatar size="small" name={user.name} url={user.userpic} />
|
||||||
|
|
|
@ -17,7 +17,6 @@ import DialogHeader from '../Inbox/DialogHeader'
|
||||||
import { apiClient } from '../../utils/apiClient'
|
import { apiClient } from '../../utils/apiClient'
|
||||||
import MessagesFallback from '../Inbox/MessagesFallback'
|
import MessagesFallback from '../Inbox/MessagesFallback'
|
||||||
import { useRouter } from '../../stores/router'
|
import { useRouter } from '../../stores/router'
|
||||||
import createChat from '../../graphql/mutation/create-chat'
|
|
||||||
|
|
||||||
const userSearch = (array: Author[], keyword: string) => {
|
const userSearch = (array: Author[], keyword: string) => {
|
||||||
const searchTerm = keyword.toLowerCase()
|
const searchTerm = keyword.toLowerCase()
|
||||||
|
@ -144,6 +143,7 @@ export const InboxView = () => {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Show when={chatsToShow}>
|
||||||
<div class="chat-list__types">
|
<div class="chat-list__types">
|
||||||
<ul>
|
<ul>
|
||||||
<li
|
<li
|
||||||
|
@ -175,12 +175,14 @@ export const InboxView = () => {
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</Show>
|
||||||
<div class="holder">
|
<div class="holder">
|
||||||
<div class="dialogs">
|
<div class="dialogs">
|
||||||
<For each={chatsToShow()}>
|
<For each={chatsToShow()}>
|
||||||
{(chat) => (
|
{(chat) => (
|
||||||
<DialogCard
|
<DialogCard
|
||||||
onClick={() => handleOpenChat(chat)}
|
onClick={() => handleOpenChat(chat)}
|
||||||
|
isOpened={chat.id === currentDialog()?.id}
|
||||||
title={chat.title || chat.members[0].name}
|
title={chat.title || chat.members[0].name}
|
||||||
members={chat.members}
|
members={chat.members}
|
||||||
ownId={currentUserId()}
|
ownId={currentUserId()}
|
||||||
|
|
|
@ -57,7 +57,7 @@ main {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
right: 10px;
|
right: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
height: $fade-height;
|
height: $fade-height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user