Skip to content

Commit

Permalink
Merge pull request #79 from illacloud/feat/flow
Browse files Browse the repository at this point in the history
Feat/flow
  • Loading branch information
Wangtaofeng authored Jan 24, 2024
2 parents 3ade52a + e19a15a commit f3cca99
Show file tree
Hide file tree
Showing 51 changed files with 2,611 additions and 306 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"clsx": "^2.0.0",
"file-saver": "^2.0.5",
"framer-motion": "^10.16.16",
"lottie-web": "^5.12.2",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions src/ILLATheme/CommonHeader/Menu/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,10 @@
@apply flex items-center gap-[8px];
}

.popoverContainerStyle {
@apply relative inline-block text-left py-[12px] px-[16px] font-medium;
}

.popoverItemStyle {
@apply flex gap-[8px] items-center text-[14px];
}

.popoverPanelStyle {
@apply absolute left-0 right-0 mt-[8px] origin-top-right rounded-md shadow-[0px_2px_16px_0px_rgba(0,0,0,0.16)] focus:outline-none py-[4px];
}

.menuItemStyle {
@apply px-[16px] py-[12px] text-[14px] hover:no-underline font-medium;
}

.panelItemContainerStyle {
@apply flex items-center justify-center w-full;
}

.panelItemStyle {
@apply text-[14px] leading-[40px] hover:no-underline font-medium;
}

.operateItemStyle {
@apply px-[24px] py-[8px] flex justify-center items-center gap-[8px] rounded-[20px] hover:no-underline font-medium;
}
Expand Down
122 changes: 23 additions & 99 deletions src/ILLATheme/CommonHeader/Menu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, { Fragment, FC } from "react"
import React, { FC } from "react"
import { MENU_ITEMS, OPERATE_MENU_ITEMS } from "../constants"
import { IHeaderMenuProps } from "../interface"
import { Menu, Transition } from "@headlessui/react"
import ChevronDownIcon from "@site/static/img/public/arrow.svg"
import Link from "@docusaurus/Link"
import clsx from "clsx"
import { sendTagEvent } from "@site/src/utils/gtag"
import style from "./index.module.css"
import { useUtmParams } from "@site/src/hooks/useUtmParams"
import { Solutions } from "../SolutionsItem"
import ProductsItem from "../ProductsItem"

export const HeaderMenu: FC<IHeaderMenuProps> = (props) => {
const { whiteTheme, hasBgColor } = props
Expand All @@ -17,103 +16,28 @@ export const HeaderMenu: FC<IHeaderMenuProps> = (props) => {
return (
<div className="w-full flex items-center justify-between">
<div className={style.menuItemContainerStyle}>
<ProductsItem whiteTheme={whiteTheme} />
<Solutions whiteTheme={whiteTheme} />
{MENU_ITEMS.map((item) => {
if (item.isPopover === false) {
return (
<Link
key={item.label}
to={getUtmParams(item.href)}
onClick={() => {
sendTagEvent({
action: "click",
category: item.category,
})
}}
className={clsx(
style.menuItemStyle,
whiteTheme
? "text-gray-02 hover:text-gray-02"
: "text-white-01 hover:text-white-01",
)}
>
{item.label}
</Link>
)
}
return (
<Menu
as="div"
className={style.popoverContainerStyle}
key={item.label}
>
<Menu.Button
className={clsx(
style.popoverItemStyle,
whiteTheme ? "text-gray-02" : "text-white-01",
)}
>
{item.label}
<ChevronDownIcon
aria-hidden="true"
className={clsx(
"w-[12px] h-[12px]",
whiteTheme ? "text-gray-02" : "text-white-01",
)}
/>
</Menu.Button>
<Transition
as={Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items
className={clsx(
style.popoverPanelStyle,
whiteTheme ? "bg-white-01" : "bg-gray-02",
)}
>
{item.items.map((subItem) => (
<Menu.Item key={subItem.label}>
{() => (
<button
className={clsx(
style.panelItemContainerStyle,
whiteTheme
? "text-gray-02 hover:bg-grayBlue-09"
: "text-white-01 hover:bg-white-09",
)}
onClick={() => {
sendTagEvent({
action: "click",
category: subItem.category,
})
}}
>
<Link
to={getUtmParams(subItem.href)}
className={clsx(
style.panelItemStyle,
whiteTheme
? "text-gray-02 hover:text-gray-02"
: "text-white-01 hover:text-white-01",
)}
>
{subItem.label}
</Link>
</button>
)}
</Menu.Item>
))}
</Menu.Items>
</Transition>
</Menu>
)
})}
{MENU_ITEMS.map((item) => (
<Link
key={item.label}
to={getUtmParams(item.href)}
onClick={() => {
sendTagEvent({
action: "click",
category: item.category,
})
}}
className={clsx(
style.menuItemStyle,
whiteTheme
? "text-gray-02 hover:text-gray-02"
: "text-white-01 hover:text-white-01",
)}
>
{item.label}
</Link>
))}
</div>
<div className={style.menuItemContainerStyle}>
{OPERATE_MENU_ITEMS.map((item) => {
Expand Down
10 changes: 8 additions & 2 deletions src/ILLATheme/CommonHeader/MobileMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { useEffect } from "react"
import Link from "@docusaurus/Link"
import IllaLogoWhiteIcon from "@site/static/img/whiteLogo.svg"
import { sendTagEvent } from "@site/src/utils/gtag"
import { MENU_ITEMS, OPERATE_MENU_ITEMS, SOLUTIONS } from "../constants"
import {
MENU_ITEMS,
OPERATE_MENU_ITEMS,
SOLUTIONS,
PRODUCT_ITEMS,
} from "../constants"
import LocaleDropdownNavbarItem from "@theme/NavbarItem/LocaleDropdownNavbarItem"
import CloseWhiteIcon from "@site/static/img/public/close.svg"
import { Disclosure } from "@headlessui/react"
Expand Down Expand Up @@ -50,7 +55,7 @@ const MobileMenu = ({ menuExpand, closeMenu }) => {
</span>
</div>
<div className="flex flex-col w-full">
{[SOLUTIONS, ...MENU_ITEMS].map((item) => {
{[PRODUCT_ITEMS, SOLUTIONS, ...MENU_ITEMS].map((item) => {
if (item?.isPopover === false) {
return <MenuItem key={item.label} item={item} />
}
Expand All @@ -76,6 +81,7 @@ const MobileMenu = ({ menuExpand, closeMenu }) => {
dropdownItemsBefore={[]}
dropdownItemsAfter={[]}
items={[]}
className="pl-0 h-[40px] text-white-01"
mobile
/>
</div>
Expand Down
19 changes: 19 additions & 0 deletions src/ILLATheme/CommonHeader/ProductsItem/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.popoverContainerStyle {
@apply relative inline-block text-left py-[12px] px-[16px] font-medium;
}

.popoverItemStyle {
@apply flex gap-[8px] items-center text-[14px];
}

.popoverPanelStyle {
@apply absolute left-0 right-0 mt-[8px] origin-top-right rounded-md shadow-[0px_2px_16px_0px_rgba(0,0,0,0.16)] focus:outline-none py-[4px];
}

.panelItemContainerStyle {
@apply flex items-center justify-center w-full;
}

.panelItemStyle {
@apply text-[14px] leading-[40px] hover:no-underline font-medium;
}
90 changes: 90 additions & 0 deletions src/ILLATheme/CommonHeader/ProductsItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { FC, Fragment } from "react"
import style from "./index.module.css"
import { Menu, Transition } from "@headlessui/react"
import clsx from "clsx"
import { PRODUCT_ITEMS } from "../constants"
import ChevronDownIcon from "@site/static/img/public/arrow.svg"
import { sendTagEvent } from "@site/src/utils/gtag"
import Link from "@docusaurus/Link"
import { useUtmParams } from "@site/src/hooks/useUtmParams"

interface ProductsItemProps {
whiteTheme: boolean
}
const ProductsItem: FC<ProductsItemProps> = ({ whiteTheme }) => {
const { items } = PRODUCT_ITEMS
const getUtmParams = useUtmParams()
return (
<Menu
as="div"
className={style.popoverContainerStyle}
key={PRODUCT_ITEMS.label}
>
<Menu.Button
className={clsx(
style.popoverItemStyle,
whiteTheme ? "text-gray-02" : "text-white-01",
)}
>
{PRODUCT_ITEMS.label}
<ChevronDownIcon
aria-hidden="true"
className={clsx(
"w-[12px] h-[12px]",
whiteTheme ? "text-gray-02" : "text-white-01",
)}
/>
</Menu.Button>
<Transition
as={Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items
className={clsx(
style.popoverPanelStyle,
whiteTheme ? "bg-white-01" : "bg-gray-02",
)}
>
{items.map((subItem) => (
<Menu.Item key={subItem.label}>
{() => (
<button
className={clsx(
style.panelItemContainerStyle,
whiteTheme
? "text-gray-02 hover:bg-grayBlue-09"
: "text-white-01 hover:bg-white-09",
)}
onClick={() => {
sendTagEvent({
action: "click",
category: subItem.category,
})
}}
>
<Link
to={getUtmParams(subItem.href)}
className={clsx(
style.panelItemStyle,
whiteTheme
? "text-gray-02 hover:text-gray-02"
: "text-white-01 hover:text-white-01",
)}
>
{subItem.label}
</Link>
</button>
)}
</Menu.Item>
))}
</Menu.Items>
</Transition>
</Menu>
)
}
export default ProductsItem
Loading

0 comments on commit f3cca99

Please sign in to comment.