mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
messages form
This commit is contained in:
parent
e45dee3c9f
commit
98c66dec8c
24 changed files with 456 additions and 42 deletions
27
src/components/profile/Message/index.tsx
Normal file
27
src/components/profile/Message/index.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import React, { FC } from 'react';
|
||||
import { IMessage } from '~/redux/types';
|
||||
import styles from './styles.scss';
|
||||
import { formatText, getURL, getPrettyDate } from '~/utils/dom';
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import classNames from 'classnames';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
|
||||
interface IProps {
|
||||
message: IMessage;
|
||||
incoming: boolean;
|
||||
}
|
||||
|
||||
const Message: FC<IProps> = ({ message, incoming }) => (
|
||||
<div className={classNames(styles.message, { [styles.incoming]: incoming })}>
|
||||
<Group className={styles.text} dangerouslySetInnerHTML={{ __html: formatText(message.text) }} />
|
||||
|
||||
<div
|
||||
className={styles.avatar}
|
||||
style={{ backgroundImage: `url("${getURL(message.from.photo, PRESETS.avatar)}")` }}
|
||||
/>
|
||||
|
||||
<div className={styles.stamp}>{getPrettyDate(message.created_at)}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
export { Message };
|
80
src/components/profile/Message/styles.scss
Normal file
80
src/components/profile/Message/styles.scss
Normal file
|
@ -0,0 +1,80 @@
|
|||
$incoming_color: transparentize($wisegreen, 0.7);
|
||||
$outgoing_color: $comment_bg;
|
||||
|
||||
.message {
|
||||
align-items: flex-end !important;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 0 0 0 42px;
|
||||
position: relative;
|
||||
|
||||
.avatar {
|
||||
// margin: 0 0 0 10px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 20px 0 0 20px;
|
||||
border-color: transparent transparent transparent $comment_bg;
|
||||
bottom: 0;
|
||||
right: 24px;
|
||||
}
|
||||
|
||||
&.incoming {
|
||||
flex-direction: row-reverse;
|
||||
padding: 0 40px 0 0;
|
||||
|
||||
.text {
|
||||
background: $incoming_color;
|
||||
border-radius: $radius $radius $radius 0;
|
||||
}
|
||||
|
||||
.stamp {
|
||||
left: auto;
|
||||
right: 42px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
border-width: 0 0 16px 16px;
|
||||
border-color: transparent transparent $incoming_color transparent;
|
||||
left: 24px;
|
||||
right: auto;
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
flex: 0 0 40px;
|
||||
border-radius: $radius;
|
||||
|
||||
background: 50% 50% no-repeat/cover;
|
||||
// display: none;
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: $gap $gap $gap * 2 $gap;
|
||||
background: $outgoing_color;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
width: 90%;
|
||||
border-radius: $radius $radius 0 $radius;
|
||||
}
|
||||
|
||||
.stamp {
|
||||
position: absolute;
|
||||
opacity: 0.5;
|
||||
// background: transparentize($color: #000000, $amount: 0.9);
|
||||
font: $font_10_regular;
|
||||
bottom: 0;
|
||||
left: 42px;
|
||||
padding: 2px $gap;
|
||||
border-radius: $radius;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue