mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added notes
This commit is contained in:
parent
592284f438
commit
fce11163aa
9 changed files with 138 additions and 11 deletions
24
src/components/notes/NoteCard/index.tsx
Normal file
24
src/components/notes/NoteCard/index.tsx
Normal file
|
@ -0,0 +1,24 @@
|
|||
import React, { VFC } from 'react';
|
||||
|
||||
import { Card } from '~/components/containers/Card';
|
||||
import { Markdown } from '~/components/containers/Markdown';
|
||||
import { Padder } from '~/components/containers/Padder';
|
||||
import { formatText, getPrettyDate } from '~/utils/dom';
|
||||
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
interface NoteCardProps {
|
||||
content: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
const NoteCard: VFC<NoteCardProps> = ({ content, createdAt }) => (
|
||||
<Card className={styles.note}>
|
||||
<Padder>
|
||||
<Markdown className={styles.wrap} dangerouslySetInnerHTML={{ __html: formatText(content) }} />
|
||||
</Padder>
|
||||
<Padder className={styles.footer}>{getPrettyDate(createdAt)}</Padder>
|
||||
</Card>
|
||||
);
|
||||
|
||||
export { NoteCard };
|
18
src/components/notes/NoteCard/styles.module.scss
Normal file
18
src/components/notes/NoteCard/styles.module.scss
Normal file
|
@ -0,0 +1,18 @@
|
|||
@import "src/styles/variables";
|
||||
@import "src/styles/mixins";
|
||||
|
||||
.note {
|
||||
min-width: 0;
|
||||
word-break: break-word;
|
||||
padding: 0;
|
||||
|
||||
& > * {
|
||||
@include row_shadow;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
font: $font_12_regular;
|
||||
text-align: right;
|
||||
opacity: 0.5;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue