Skip to content

Commit

Permalink
feat: add help menu
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasBuchfink committed Sep 16, 2024
1 parent 0eebd29 commit 0e0504d
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions inlang/source-code/fink2/src/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ import {
withPollingAtom,
} from "./state.ts";
import { SetStateAction, useEffect, useMemo, useState } from "react";
import SlDialog from "@shoelace-style/shoelace/dist/react/dialog/index.js";
import { loadProjectInMemory, newProject } from "@inlang/sdk2";
import { loadProjectInMemory, newProject, merge } from "@inlang/sdk2";
import {
SlInput,
SlButton,
SlDropdown,
SlMenu,
SlMenuItem,
SlDialog
} from "@shoelace-style/shoelace/dist/react";
import { Link } from "react-router-dom";
import { merge } from "../../../../lix/packages/sdk/dist/merge/merge.js";
import { SlSelectEvent } from "@shoelace-style/shoelace";
import SubNavigation from "./components/SubNavigation.tsx";
import { handleDownload } from "./helper/utils.ts";
import Footer from "./components/Footer.tsx";
import Footer, { getFinkResourcesLinks } from "./components/Footer.tsx";

export default function Layout(props: { children: React.ReactNode }) {
const [, setWithPolling] = useAtom(withPollingAtom);
Expand Down Expand Up @@ -86,6 +84,7 @@ const MenuBar = () => {
</div>

<div className="flex gap-[4px]">
<HelpMenu />
<DownloadButton />
<MergeButton />
</div>
Expand Down Expand Up @@ -271,6 +270,31 @@ export const CreateProjectDialog = (props: {
);
};

const HelpMenu = () => {
return (
<SlDropdown placement="bottom-end" className="peer">
<button
slot="trigger"
className="h-8 px-2 flex justify-center items-center text-zinc-500 hover:text-zinc-950 cursor-pointer"
>
Need Help?
</button>
<SlMenu className="w-fit">
{getFinkResourcesLinks().map((link) => (
<SlMenuItem>
<a href={link.href} target="_blank">
{link.name}
</a>
{link.name === "About the ecosystem" && (
<div className="w-full border-b border-surface-200 my-1" />
)}
</SlMenuItem>
))}
</SlMenu>
</SlDropdown>
)
}

const DownloadButton = () => {
const [project] = useAtom(projectAtom);
const [selectedProjectPath] = useAtom(selectedProjectPathAtom);
Expand Down

0 comments on commit 0e0504d

Please sign in to comment.