Skip to content

Commit

Permalink
add docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
asanchezyali committed Aug 31, 2023
1 parent a2a13d9 commit 883ed93
Show file tree
Hide file tree
Showing 19 changed files with 3,019 additions and 418 deletions.
1 change: 1 addition & 0 deletions morpheus-client/components/Footer/Footer.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
display: flex;
align-items: center;
background: colors.$background-primary !important;
z-index: 10;

@include media.mobile {
height: auto;
Expand Down
1 change: 1 addition & 0 deletions morpheus-client/components/Navbar/Navbar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@use "styles/typography";

.navbarContainer {
position: fixed;
height: 80px;
min-height: 80px;
max-height: 80px;
Expand Down
8 changes: 5 additions & 3 deletions morpheus-client/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import useWindowDimensions from "../../hooks/useWindowDimensions";
import { User } from "@/models/models";
import { MOBILE_SCREEN_WIDTH } from "@/utils/constants";
import styles from "./Navbar.module.scss";
import { cn } from "@/utils/styles";

type NavMenuProps = {
user: User;
Expand Down Expand Up @@ -56,8 +57,8 @@ const NavMenu = (props: NavMenuProps) => {
<Link className={getLinkStyles("gallery")} href={"/gallery"}>
Gallery
</Link>
<Link className={getLinkStyles("about")} href={"/about"}>
About
<Link className={getLinkStyles("docs")} href={"/docs"}>
Docs
</Link>
</div>

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

interface NavbarProps {
showBrand?: boolean;
fixed?: boolean;
}

const Navbar = (props: NavbarProps) => {
Expand Down Expand Up @@ -114,7 +116,7 @@ const Navbar = (props: NavbarProps) => {
);

return (
<div className={styles.navbarContainer}>
<div className={styles.navbarContainer} style={{ position: props.fixed ? "fixed" : "relative" }}>
{isMobile ? (
<Fragment>
<BurgerMenu
Expand Down
73 changes: 73 additions & 0 deletions morpheus-client/components/Pre/Pre.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { useState, useRef } from "react";

const Pre = (props: any) => {
const textInput = useRef<HTMLDivElement>(null);
const [hovered, setHovered] = useState(false);
const [copied, setCopied] = useState(false);

const onEnter = () => {
setHovered(true);
};

const onExit = () => {
setHovered(false);
setCopied(false);
};

const onCopy = () => {
setCopied(true);
if (textInput.current !== null && textInput.current.textContent !== null) {
navigator.clipboard.writeText(textInput.current.textContent);
setTimeout(() => {
setCopied(false);
}, 2000);
}
};

return (
<div ref={textInput} onMouseEnter={onEnter} onMouseLeave={onExit} className="relative">
{hovered && (
<button
aria-label="Copy code"
type="button"
className={`absolute right-2 top-2 h-8 w-8 rounded border-2 bg-gray-700 p-1 dark:bg-gray-800 ${
copied ? "border-green-400 focus:border-green-400 focus:outline-none" : "border-gray-300"
}`}
onClick={onCopy}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
stroke="currentColor"
fill="none"
className={copied ? "text-green-400" : "text-gray-300"}
>
{copied ? (
<>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
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"
/>
</>
) : (
<>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
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"
/>
</>
)}
</svg>
</button>
)}

<pre>{props.children}</pre>
</div>
);
};

export default Pre;
Loading

0 comments on commit 883ed93

Please sign in to comment.