Skip to content
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

Email: Markdown editor #321

Open
wants to merge 2 commits into
base: opensourcenight
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions src/components/Examples/pages/Email/Email.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,47 @@ $block: '.#{variables.$ns}examples-email';
border-top: 1px solid var(--g-color-line-generic);
gap: var(--g-spacing-5);
}

&__container {
height: 80vh;
margin: 2rem 0;
}

&__navigation {
//flex: 2;
border: #4e3d2e 1px solid;
}
&__mail-list {
//flex: 3;
border: #4e3d2e 1px solid;
}

&__mail-content {
// /flex: 3;
border: #4e3d2e 1px solid;
}

&__icons {
height: 52px;
border: #4e3d2e 1px solid;
}

&__left-icons {
width: 152px;
}

&__name-container {
border: #4e3d2e 1px solid;
height: 64px;
}

&__mail-text {
border: #4e3d2e 1px solid;
height: 300px;
}

&__markdown-panel {
border: #4e3d2e 1px solid;
height: 400px;
}
}
103 changes: 76 additions & 27 deletions src/components/Examples/pages/Email/Email.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import {Button, Flex, Icon, Link, Text} from '@gravity-ui/uikit';
'use client';
import {Clock, Folder, LayoutTabs, TrashBin} from '@gravity-ui/icons';
import {MarkdownEditorView, useMarkdownEditor} from '@gravity-ui/markdown-editor';
import {Button, Col, Container, Flex, Icon, Link, Row, ThemeProvider} from '@gravity-ui/uikit';
import {toaster} from '@gravity-ui/uikit/toaster-singleton-react-18';
import {useEffect, useState} from 'react';

import figmaIcon from '../../../../assets/icons/figma-fill.svg';
import {block} from '../../../../utils';
Expand All @@ -12,32 +17,76 @@ type EmailProps = {};
// @todo-opensourcenight Make email page
// https://www.figma.com/design/MnKaEyxPs9Zeyhg6pmf4uX/OS-Night-Design-(Published)?node-id=1-20225&t=cBOGiZgT0jwhnCOY-4
export const Email: React.FC<EmailProps> = () => {
const editor = useMarkdownEditor({allowHTML: false});
const [ready, setReady] = useState(false);
useEffect(() => {
setReady(true);
});
return (
<div className={b()}>
<main className={b('main')}>
<Text variant="code-3">
<Flex direction="row" justifyContent="space-between">
<span>@todo-opensourcenight make email page</span>
<Button
key="figma"
className={b('button')}
view="action"
size="xl"
href={
'https://www.figma.com/design/MnKaEyxPs9Zeyhg6pmf4uX/OS-Night-Design-(Published)?node-id=1-20225&t=cBOGiZgT0jwhnCOY-4'
}
target="_blank"
>
<Icon className={b('button-icon')} data={figmaIcon} size={16} />
<span>Open Figma</span>
</Button>
</Flex>
</Text>
</main>
<footer className={b('footer')}>
<Link href={'/examples'}>Open in Examples page</Link>
<Link href={'/examples/email'}>Open in Separate page</Link>
</footer>
</div>
<ThemeProvider theme="dark">
<div className={b('what')}>
<main className={b('main')}>
<Container>
<Row space={0} className={b('container')}>
<Col s="3" className={b('navigation')}>
what
</Col>
<Col s="4" className={b('mail-list')}>
the
</Col>
<Col s="5" className={b('mail-content')}>
<Row space={0} className={b('icons')}>
<Col s="12" className={b('left-icons')}>
<Flex>
<Folder />
<LayoutTabs />
<TrashBin />
<Clock />
</Flex>
</Col>
</Row>

<Row space={0} className={b('name-container')}>
Имя и дата
</Row>
<Row space={0} className={b('mail-text')}>
Текст
</Row>
<Row space={0} className={b('markdown-panel')}>
{ready ? (
<MarkdownEditorView
stickyToolbar
autofocus
toaster={toaster}
editor={editor}
/>
) : (
<></>
)}
</Row>
</Col>
</Row>
</Container>
</main>

<footer className={b('footer')}>
<Link href={'/examples'}>Open in Examples page</Link>
<Link href={'/examples/email'}>Open in Separate page</Link>
<Button
key="figma"
className={b('button')}
view="action"
size="xl"
href={
'https://www.figma.com/design/MnKaEyxPs9Zeyhg6pmf4uX/OS-Night-Design-(Published)?node-id=1-20225&t=cBOGiZgT0jwhnCOY-4'
}
target="_blank"
>
<Icon className={b('button-icon')} data={figmaIcon} size={16} />
<span>Open Figma</span>
</Button>
</footer>
</div>
</ThemeProvider>
);
};