1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

🚧 Start working on RepositoryViewer

This commit is contained in:
Steffo 2021-05-18 16:10:32 +02:00
parent ab538e6b2b
commit 22e8a3b94a
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,22 @@
import React from "react"
import Style from "./RepositoryViewer.module.css"
import classNames from "classnames"
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
export default function RepositoryViewer({
id,
}) {
return (
<ContextRepositoryViewer.Provider
value={{
id,
}}
>
<div className={classNames(Style.RepositoryViewer, className)}>
</div>
</ContextRepositoryViewer.Provider>
)
}

View file

@ -0,0 +1,16 @@
.RepositoryViewer {
display: grid;
grid-template-areas:
"b c d"
"b e e"
"b f f"
"b g g";
grid-template-columns: 400px 1fr 1fr;
grid-template-rows: auto auto 1fr auto;
grid-gap: 10px;
width: 100%;
height: 100%;
}

View file

@ -0,0 +1,7 @@
import { createContext } from "react"
/**
* @todo Document this.
*/
export default createContext(null)

View file

@ -0,0 +1,14 @@
import { useContext } from "react"
import ContextRepositoryViewer from "../contexts/ContextRepositoryViewer"
/**
* @todo Document this.
*/
export default function useRepositoryViewer() {
const context = useContext(ContextRepositoryViewer)
if(!context) {
throw new Error("This component must be placed inside a RepositoryViewer.")
}
return context
}