Add markdown, message component [WiP]
This commit is contained in:
parent
ecde2d8c99
commit
b15b31dd2f
7
src/components/Inbox/Message.module.scss
Normal file
7
src/components/Inbox/Message.module.scss
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.Message {
|
||||||
|
.own {
|
||||||
|
}
|
||||||
|
.body {
|
||||||
|
// message text
|
||||||
|
}
|
||||||
|
}
|
17
src/components/Inbox/Message.tsx
Normal file
17
src/components/Inbox/Message.tsx
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { clsx } from 'clsx'
|
||||||
|
import styles from './Message.module.scss'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
body: string
|
||||||
|
isOwn: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const Message = (props: Props) => {
|
||||||
|
return (
|
||||||
|
<div class={clsx(styles.Message, props.isOwn && styles.own)}>
|
||||||
|
<div class={styles.body}>{props.body}</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Message
|
|
@ -6,6 +6,7 @@ import { Loading } from '../Loading'
|
||||||
import DialogCard from '../Inbox/DialogCard'
|
import DialogCard from '../Inbox/DialogCard'
|
||||||
import Search from '../Inbox/Search'
|
import Search from '../Inbox/Search'
|
||||||
import { useAuthorsStore } from '../../stores/zine/authors'
|
import { useAuthorsStore } from '../../stores/zine/authors'
|
||||||
|
import MarkdownIt from 'markdown-it'
|
||||||
// const { session } = useAuthStore()
|
// const { session } = useAuthStore()
|
||||||
|
|
||||||
import '../../styles/Inbox.scss'
|
import '../../styles/Inbox.scss'
|
||||||
|
@ -13,6 +14,9 @@ import '../../styles/Inbox.scss'
|
||||||
import { createClient } from '@urql/core'
|
import { createClient } from '@urql/core'
|
||||||
import { useSession } from '../../context/session'
|
import { useSession } from '../../context/session'
|
||||||
|
|
||||||
|
const md = new MarkdownIt({
|
||||||
|
linkify: true
|
||||||
|
})
|
||||||
const OWNER_ID = '501'
|
const OWNER_ID = '501'
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
url: 'https://graphqlzero.almansi.me/api'
|
url: 'https://graphqlzero.almansi.me/api'
|
||||||
|
@ -183,7 +187,7 @@ export const InboxView = () => {
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div class="conversation__message">
|
<div class="conversation__message">
|
||||||
{comment.body}
|
<div innerHTML={md.render(comment.body)} />
|
||||||
<div class="conversation__message-details">
|
<div class="conversation__message-details">
|
||||||
<time>14:26</time>
|
<time>14:26</time>
|
||||||
{comment.email} id: {comment.id}
|
{comment.email} id: {comment.id}
|
||||||
|
|
|
@ -283,6 +283,18 @@ body {
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: underline;
|
||||||
|
&:hover {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.conversation__context-popup-control {
|
.conversation__context-popup-control {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -303,7 +315,6 @@ body {
|
||||||
.conversation__message-container--other {
|
.conversation__message-container--other {
|
||||||
.conversation__message {
|
.conversation__message {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
border-right: 0.3em solid #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.conversation__context-popup-control {
|
.conversation__context-popup-control {
|
||||||
|
@ -317,7 +328,6 @@ body {
|
||||||
|
|
||||||
.conversation__message {
|
.conversation__message {
|
||||||
background: #000;
|
background: #000;
|
||||||
border-left: 0.3em solid #fff;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user