Skip to content

Commit 6a8f49c

Browse files
Layout dropdown shared
1 parent 0cbf5db commit 6a8f49c

File tree

2 files changed

+121
-1
lines changed

2 files changed

+121
-1
lines changed

components/LayoutDropdown.tsx

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import { Fragment } from 'react'
2+
import { Menu, Transition } from '@headlessui/react'
3+
import { Tooltip } from '@nextui-org/react'
4+
import Image from 'next/image';
5+
import { combineClassNames } from '../../javascript-functions/general';
6+
import { LayoutDropdownProps } from '../types/dropdown';
7+
8+
export default function LayoutDropdown(props: LayoutDropdownProps) {
9+
return (
10+
<Menu as="div" className="relative inline-block text-left">
11+
<div>
12+
<Menu.Button>
13+
<Tooltip color="invert" content="Kern AI" placement="right">
14+
<div
15+
className='cursor-pointer group flex items-center p-2 text-sm font-medium rounded-md border border-gray-200 hover:bg-gray-50'
16+
>
17+
<Image src="/workflow/kern-icon.png" width="32" height="32" />
18+
</div>
19+
</Tooltip>
20+
</Menu.Button>
21+
</div>
22+
23+
<Transition
24+
as={Fragment}
25+
enter="transition ease-out duration-100"
26+
enterFrom="transform opacity-0 scale-95"
27+
enterTo="transform opacity-100 scale-100"
28+
leave="transition ease-in duration-75"
29+
leaveFrom="transform opacity-100 scale-100"
30+
leaveTo="transform opacity-0 scale-95"
31+
>
32+
<Menu.Items className="fixed bottom-[74px] left-20 z-50 w-40 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
33+
<div className="py-1">
34+
{props.visibility[0] ? (
35+
<Menu.Item>
36+
{({ active }) => (
37+
<a
38+
href="/welcome"
39+
rel="noopener noreferrer"
40+
className={combineClassNames(
41+
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
42+
'group flex items-center px-4 py-2 text-sm cursor-pointer font-mono'
43+
)}
44+
>
45+
<Image src="/workflow/kern-icon.png" width="21" height="21" />
46+
<span className='ml-2'>cockpit</span>
47+
</a>
48+
)}
49+
</Menu.Item>
50+
) : null}
51+
52+
{props.visibility[1] ? (
53+
<Menu.Item>
54+
{({ active }) => (
55+
<a
56+
href="/refinery/projects"
57+
rel="noopener noreferrer"
58+
className={combineClassNames(
59+
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
60+
'group flex items-center px-4 py-2 text-sm cursor-pointer font-mono'
61+
)}
62+
>
63+
<Image src="/workflow/refinery-icon.png" width="21" height="21" />
64+
<span className='ml-2'>refinery</span>
65+
</a>
66+
)}
67+
</Menu.Item>
68+
) : null}
69+
70+
71+
{props.visibility[2] ? (
72+
<Menu.Item>
73+
{({ active }) => (
74+
<a
75+
href="/gates"
76+
rel="noopener noreferrer"
77+
className={combineClassNames(
78+
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
79+
'group flex items-center px-4 py-2 text-sm cursor-pointer font-mono'
80+
)}
81+
>
82+
<Image src="/workflow/gates-icon.png" width="21" height="21" />
83+
<span className='ml-2'>gates</span>
84+
</a>
85+
)}
86+
</Menu.Item>
87+
) : null}
88+
89+
{props.visibility[3] ? (
90+
<Menu.Item>
91+
{({ active }) => (
92+
<a
93+
href="/workflow/workflows"
94+
rel="noopener noreferrer"
95+
className={combineClassNames(
96+
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
97+
'group flex items-center px-4 py-2 text-sm cursor-pointer font-mono'
98+
)}
99+
>
100+
<Image
101+
src="/gates/workflow-icon.png"
102+
width={21}
103+
height={21}
104+
alt="workflow"
105+
/>
106+
<span className='ml-2'>workflow</span>
107+
</a>
108+
)}
109+
</Menu.Item>
110+
) : null}
111+
</div>
112+
</Menu.Items>
113+
</Transition>
114+
</Menu>
115+
)
116+
}

types/dropdown.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ export type DropdownProps = {
1818
hasIconClock?: boolean;
1919
onlyArray?: boolean;
2020
dropdownWidth?: string;
21-
}
21+
}
22+
23+
export type LayoutDropdownProps = {
24+
visibility: boolean[];
25+
};

0 commit comments

Comments
 (0)