|
@@ -1,10 +1,10 @@ |
|
|
import * as React from 'react' |
|
|
import * as React from 'react' |
|
|
import Head from 'next/head' |
|
|
import Head from 'next/head' |
|
|
import * as T from '@tesseract-design/react-common' |
|
|
import * as T from '@tesseract-design/react-common' |
|
|
import {LeftSidebarWithMenu} from '@tesseract-design/viewfinder' |
|
|
|
|
|
|
|
|
import {LeftSidebarWithMenu} from '@theoryofnekomata/viewfinder' |
|
|
import styled from 'styled-components' |
|
|
import styled from 'styled-components' |
|
|
import Link from '../../molecules/Link' |
|
|
import Link from '../../molecules/Link' |
|
|
import {Subpage} from '../../../utils/query' |
|
|
|
|
|
|
|
|
import { QueryFragment, Subpage } from '../../../utils/query' |
|
|
import Note from '../../../models/Note' |
|
|
import Note from '../../../models/Note' |
|
|
import Brand from '../../molecules/Brand' |
|
|
import Brand from '../../molecules/Brand' |
|
|
import NoteLinkContent from '../../molecules/NoteLinkContent' |
|
|
import NoteLinkContent from '../../molecules/NoteLinkContent' |
|
@@ -26,6 +26,10 @@ const CenteredContent = styled(LeftSidebarWithMenu.ContentContainer)({ |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const Content = styled('div')({ |
|
|
|
|
|
margin: '2rem 0', |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
const SidebarTitle = styled('h1')({ |
|
|
const SidebarTitle = styled('h1')({ |
|
|
margin: 0, |
|
|
margin: 0, |
|
|
lineHeight: '4rem', |
|
|
lineHeight: '4rem', |
|
@@ -35,6 +39,61 @@ const SidebarSubtitle = styled('p')({ |
|
|
margin: '2rem 0', |
|
|
margin: '2rem 0', |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const TopBarComponent = styled('div')({ |
|
|
|
|
|
backgroundColor: 'var(--color-bg, white)', |
|
|
|
|
|
'::before': { |
|
|
|
|
|
content: "''", |
|
|
|
|
|
width: '100%', |
|
|
|
|
|
height: '100%', |
|
|
|
|
|
position: 'absolute', |
|
|
|
|
|
top: 0, |
|
|
|
|
|
left: 0, |
|
|
|
|
|
pointerEvents: 'none', |
|
|
|
|
|
}, |
|
|
|
|
|
'::after': { |
|
|
|
|
|
backgroundColor: 'black', |
|
|
|
|
|
opacity: 0.5, |
|
|
|
|
|
content: "''", |
|
|
|
|
|
width: '100%', |
|
|
|
|
|
height: '100%', |
|
|
|
|
|
position: 'absolute', |
|
|
|
|
|
top: 0, |
|
|
|
|
|
left: 0, |
|
|
|
|
|
pointerEvents: 'none', |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const SidebarMainComponent = styled('div')({ |
|
|
|
|
|
backgroundColor: 'var(--color-bg, white)', |
|
|
|
|
|
zIndex: 2, |
|
|
|
|
|
'::after': { |
|
|
|
|
|
backgroundColor: 'black', |
|
|
|
|
|
opacity: 0.25, |
|
|
|
|
|
content: "''", |
|
|
|
|
|
width: '100%', |
|
|
|
|
|
height: '100%', |
|
|
|
|
|
position: 'absolute', |
|
|
|
|
|
top: 0, |
|
|
|
|
|
left: 0, |
|
|
|
|
|
pointerEvents: 'none', |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const SidebarMenuComponent = styled('div')({ |
|
|
|
|
|
backgroundColor: 'var(--color-bg, white)', |
|
|
|
|
|
'::after': { |
|
|
|
|
|
backgroundColor: 'black', |
|
|
|
|
|
opacity: 0.4, |
|
|
|
|
|
content: "''", |
|
|
|
|
|
width: '100%', |
|
|
|
|
|
height: '100%', |
|
|
|
|
|
position: 'absolute', |
|
|
|
|
|
top: 0, |
|
|
|
|
|
left: 0, |
|
|
|
|
|
pointerEvents: 'none', |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
type Props = { |
|
|
type Props = { |
|
|
subpage: Subpage, |
|
|
subpage: Subpage, |
|
|
notes: Note[], |
|
|
notes: Note[], |
|
@@ -60,6 +119,9 @@ const NoteView: React.FC<Props> = ({ |
|
|
</title> |
|
|
</title> |
|
|
</Head> |
|
|
</Head> |
|
|
<LeftSidebarWithMenu.Layout |
|
|
<LeftSidebarWithMenu.Layout |
|
|
|
|
|
topBarComponent={TopBarComponent} |
|
|
|
|
|
sidebarMainComponent={SidebarMainComponent} |
|
|
|
|
|
sidebarMenuComponent={SidebarMenuComponent} |
|
|
brand={ |
|
|
brand={ |
|
|
<Brand /> |
|
|
<Brand /> |
|
|
} |
|
|
} |
|
@@ -92,8 +154,26 @@ const NoteView: React.FC<Props> = ({ |
|
|
]} |
|
|
]} |
|
|
sidebarMainOpen={subpage === Subpage.SIDEBAR} |
|
|
sidebarMainOpen={subpage === Subpage.SIDEBAR} |
|
|
moreItemsOpen={subpage === Subpage.MORE} |
|
|
moreItemsOpen={subpage === Subpage.MORE} |
|
|
|
|
|
menuLink={ |
|
|
|
|
|
<Link |
|
|
|
|
|
href={{ |
|
|
|
|
|
query: currentNote |
|
|
|
|
|
? { |
|
|
|
|
|
noteId: currentNote.id, |
|
|
|
|
|
[QueryFragment.SUBPAGE]: Subpage.SIDEBAR, |
|
|
|
|
|
} |
|
|
|
|
|
: { |
|
|
|
|
|
[QueryFragment.SUBPAGE]: Subpage.SIDEBAR, |
|
|
|
|
|
}, |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<T.Icon |
|
|
|
|
|
name="menu" |
|
|
|
|
|
/> |
|
|
|
|
|
</Link> |
|
|
|
|
|
} |
|
|
sidebarMain={ |
|
|
sidebarMain={ |
|
|
<> |
|
|
|
|
|
|
|
|
<Content> |
|
|
{currentFolder && ( |
|
|
{currentFolder && ( |
|
|
<LeftSidebarWithMenu.SidebarMainContainer> |
|
|
<LeftSidebarWithMenu.SidebarMainContainer> |
|
|
<SidebarTitle> |
|
|
<SidebarTitle> |
|
@@ -139,7 +219,7 @@ const NoteView: React.FC<Props> = ({ |
|
|
</LeftSidebarWithMenu.SidebarMainContainer> |
|
|
</LeftSidebarWithMenu.SidebarMainContainer> |
|
|
</SidebarLink> |
|
|
</SidebarLink> |
|
|
))} |
|
|
))} |
|
|
</> |
|
|
|
|
|
|
|
|
</Content> |
|
|
} |
|
|
} |
|
|
moreLinkMenuItem={{ |
|
|
moreLinkMenuItem={{ |
|
|
label: 'More', |
|
|
label: 'More', |
|
@@ -150,7 +230,8 @@ const NoteView: React.FC<Props> = ({ |
|
|
), |
|
|
), |
|
|
url: { |
|
|
url: { |
|
|
query: { |
|
|
query: { |
|
|
subpage: 'more', |
|
|
|
|
|
|
|
|
noteId: currentNote?.id, |
|
|
|
|
|
[QueryFragment.SUBPAGE]: 'more', |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}} |
|
|
}} |
|
@@ -189,12 +270,14 @@ const NoteView: React.FC<Props> = ({ |
|
|
</CenteredContent> |
|
|
</CenteredContent> |
|
|
)} |
|
|
)} |
|
|
{(currentNote as Note) && ( |
|
|
{(currentNote as Note) && ( |
|
|
<NoteForm |
|
|
|
|
|
defaultValues={{ |
|
|
|
|
|
title: currentNote.title, |
|
|
|
|
|
content: currentNote.contentVersions.slice(-1)[0].content, |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<Content> |
|
|
|
|
|
<NoteForm |
|
|
|
|
|
defaultValues={{ |
|
|
|
|
|
title: currentNote.title, |
|
|
|
|
|
content: currentNote.contentVersions.slice(-1)[0].content, |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
</Content> |
|
|
)} |
|
|
)} |
|
|
</LeftSidebarWithMenu.Layout> |
|
|
</LeftSidebarWithMenu.Layout> |
|
|
</> |
|
|
</> |
|
|