Skip to content

Commit dbf05e2

Browse files
committed
add docs page
1 parent a2a13d9 commit dbf05e2

19 files changed

Lines changed: 3020 additions & 418 deletions

File tree

morpheus-client/components/Footer/Footer.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
display: flex;
99
align-items: center;
1010
background: colors.$background-primary !important;
11+
z-index: 10;
1112

1213
@include media.mobile {
1314
height: auto;

morpheus-client/components/Navbar/Navbar.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@use "styles/typography";
44

55
.navbarContainer {
6+
position: fixed;
67
height: 80px;
78
min-height: 80px;
89
max-height: 80px;

morpheus-client/components/Navbar/Navbar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import useWindowDimensions from "../../hooks/useWindowDimensions";
1212
import { User } from "@/models/models";
1313
import { MOBILE_SCREEN_WIDTH } from "@/utils/constants";
1414
import styles from "./Navbar.module.scss";
15+
import { cn } from "@/utils/styles";
1516

1617
type NavMenuProps = {
1718
user: User;
@@ -56,8 +57,8 @@ const NavMenu = (props: NavMenuProps) => {
5657
<Link className={getLinkStyles("gallery")} href={"/gallery"}>
5758
Gallery
5859
</Link>
59-
<Link className={getLinkStyles("about")} href={"/about"}>
60-
About
60+
<Link className={getLinkStyles("docs")} href={"/docs"}>
61+
Docs
6162
</Link>
6263
</div>
6364

@@ -79,6 +80,7 @@ const NavMenu = (props: NavMenuProps) => {
7980

8081
interface NavbarProps {
8182
showBrand?: boolean;
83+
fixed?: boolean;
8284
}
8385

8486
const Navbar = (props: NavbarProps) => {
@@ -114,7 +116,7 @@ const Navbar = (props: NavbarProps) => {
114116
);
115117

116118
return (
117-
<div className={styles.navbarContainer}>
119+
<div className={styles.navbarContainer} style={{ position: props.fixed ? "fixed" : "relative" }}>
118120
{isMobile ? (
119121
<Fragment>
120122
<BurgerMenu
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { useState, useRef } from "react";
2+
3+
const Pre = (props: any) => {
4+
const textInput = useRef<HTMLDivElement>(null);
5+
const [hovered, setHovered] = useState(false);
6+
const [copied, setCopied] = useState(false);
7+
8+
const onEnter = () => {
9+
setHovered(true);
10+
};
11+
12+
const onExit = () => {
13+
setHovered(false);
14+
setCopied(false);
15+
};
16+
17+
const onCopy = () => {
18+
setCopied(true);
19+
if (textInput.current !== null && textInput.current.textContent !== null) {
20+
navigator.clipboard.writeText(textInput.current.textContent);
21+
setTimeout(() => {
22+
setCopied(false);
23+
}, 2000);
24+
}
25+
};
26+
27+
return (
28+
<div ref={textInput} onMouseEnter={onEnter} onMouseLeave={onExit} className="relative">
29+
{hovered && (
30+
<button
31+
aria-label="Copy code"
32+
type="button"
33+
className={`absolute right-2 top-2 h-8 w-8 rounded border-2 bg-gray-700 p-1 dark:bg-gray-800 ${
34+
copied ? "border-green-400 focus:border-green-400 focus:outline-none" : "border-gray-300"
35+
}`}
36+
onClick={onCopy}
37+
>
38+
<svg
39+
xmlns="http://www.w3.org/2000/svg"
40+
viewBox="0 0 24 24"
41+
stroke="currentColor"
42+
fill="none"
43+
className={copied ? "text-green-400" : "text-gray-300"}
44+
>
45+
{copied ? (
46+
<>
47+
<path
48+
strokeLinecap="round"
49+
strokeLinejoin="round"
50+
strokeWidth={2}
51+
d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"
52+
/>
53+
</>
54+
) : (
55+
<>
56+
<path
57+
strokeLinecap="round"
58+
strokeLinejoin="round"
59+
strokeWidth={2}
60+
d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
61+
/>
62+
</>
63+
)}
64+
</svg>
65+
</button>
66+
)}
67+
68+
<pre>{props.children}</pre>
69+
</div>
70+
);
71+
};
72+
73+
export default Pre;

0 commit comments

Comments
 (0)