-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPage.tsx
More file actions
29 lines (26 loc) · 784 Bytes
/
Page.tsx
File metadata and controls
29 lines (26 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Source } from '../lib/sources/types.js'
import Cell from './Cell.js'
import File, { FileConfig } from './File.js'
import Folder from './Folder.js'
export type PageConfig = FileConfig
export interface Navigation {
col?: number
row?: number
}
interface PageProps {
source: Source,
navigation?: Navigation,
config?: PageConfig
}
export default function Page({ source, navigation, config }: PageProps) {
if (source.kind === 'directory') {
return <Folder source={source} config={config}/>
}
if (navigation?.row !== undefined && navigation.col !== undefined) {
// cell view
return <Cell source={source} row={navigation.row} col={navigation.col} config={config} />
} else {
// file view
return <File source={source} config={config} />
}
}