/* * Copyright 2025 coze-dev Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type FC, type ReactNode, type HtmlHTMLAttributes } from 'react'; import { merge } from 'lodash-es'; import { IconCozCross } from '@coze-arch/coze-design/icons'; import { Button, Modal, type ModalProps } from '@coze-arch/coze-design'; import './index.less'; export type NavModalProps = Omit & { navigation: ReactNode; mainContent: ReactNode; mainContentTitle?: ReactNode | string; }; const NAV_MODAL_BODY_HEIGHT = 604; const NAV_MODAL_PADDING_TOP = 24; const NAV_MODAL_CLOSE_BUTTON_SIDE_LENGTH = 40; export const NAV_MODAL_MAIN_CONTENT_HEIGHT = NAV_MODAL_BODY_HEIGHT - NAV_MODAL_PADDING_TOP - NAV_MODAL_CLOSE_BUTTON_SIDE_LENGTH; export const NavModal: FC = props => { const { title, navigation, mainContent, mainContentTitle, className, onCancel, closeIcon, style, ...restProps } = props; return (
{title}
{navigation}
{mainContentTitle ? (
{mainContentTitle}
) : null} {closeIcon || ( )}
{mainContent}
); }; export interface NavModalItemProps extends HtmlHTMLAttributes { selectedIcon?: ReactNode; unselectedIcon?: ReactNode; text: string; selected?: boolean; onClick?: () => void; suffix?: ReactNode; } export const NavModalItem: FC = props => { const { text, selected = false, selectedIcon = <>, unselectedIcon = <>, suffix, onClick, className, } = props; return (
{selected ? selectedIcon : unselectedIcon}
{text}
{typeof suffix === 'string' ? (
{suffix}
) : ( suffix ?? <> )}
); }; NavModal.displayName = 'NavModal'; NavModalItem.displayName = 'NavModalItem';