mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
fix: add button related
This commit is contained in:
parent
b3316a4dc8
commit
bd4a979f62
@ -1,25 +1,32 @@
|
||||
import type { ButtonProps } from '@heroui/react'
|
||||
import { Button } from '@heroui/react'
|
||||
import { cn } from '@renderer/utils'
|
||||
import type { ButtonProps } from 'antd'
|
||||
import { Button } from 'antd'
|
||||
import { PlusIcon } from 'lucide-react'
|
||||
import type { FC } from 'react'
|
||||
import styled from 'styled-components'
|
||||
|
||||
interface Props extends ButtonProps {
|
||||
children: React.ReactNode
|
||||
}
|
||||
const StyledButton = styled(Button)`
|
||||
height: 36px;
|
||||
width: calc(var(--assistants-width) - 20px);
|
||||
justify-content: flex-start;
|
||||
border-radius: 8px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
color: var(--color-text-2);
|
||||
|
||||
const AddButton: FC<Props> = ({ children, className, ...props }) => {
|
||||
&:hover {
|
||||
background-color: var(--color-list-item);
|
||||
}
|
||||
`
|
||||
|
||||
const AddButton: FC<ButtonProps> = ({ ...props }) => {
|
||||
return (
|
||||
<Button
|
||||
<StyledButton
|
||||
{...props}
|
||||
onPress={props.onPress}
|
||||
className={cn(
|
||||
'h-9 w-[calc(var(--assistants-width)-20px)] justify-start rounded-lg bg-transparent px-3 text-[13px] text-[var(--color-text-2)] hover:bg-[var(--color-list-item)]',
|
||||
className
|
||||
)}
|
||||
startContent={<PlusIcon size={16} className="shrink-0" />}>
|
||||
{children}
|
||||
</Button>
|
||||
type="text"
|
||||
onClick={props.onClick}
|
||||
icon={<PlusIcon size={16} style={{ flexShrink: 0 }} />}>
|
||||
{props.children}
|
||||
</StyledButton>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -98,9 +98,10 @@ const Sessions: React.FC<SessionsProps> = ({ agentId }) => {
|
||||
|
||||
return (
|
||||
<div className="sessions-tab flex h-full w-full flex-col p-2">
|
||||
<AddButton onPress={createDefaultSession} className="mb-2" isDisabled={creatingSession}>
|
||||
<AddButton onClick={createDefaultSession} disabled={creatingSession}>
|
||||
{t('agent.session.add.title')}
|
||||
</AddButton>
|
||||
<div className="my-1"></div>
|
||||
{/* h-9 */}
|
||||
<DynamicVirtualList
|
||||
list={sessions}
|
||||
|
||||
@ -496,9 +496,12 @@ export const Topics: React.FC<Props> = ({ assistant: _assistant, activeTopic, se
|
||||
style={{ height: '100%', padding: '11px 0 10px 10px' }}
|
||||
itemContainerStyle={{ paddingBottom: '8px' }}
|
||||
header={
|
||||
<AddButton onPress={() => EventEmitter.emit(EVENT_NAMES.ADD_NEW_TOPIC)} className="mb-2">
|
||||
{t('chat.add.topic.title')}
|
||||
</AddButton>
|
||||
<>
|
||||
<AddButton onClick={() => EventEmitter.emit(EVENT_NAMES.ADD_NEW_TOPIC)}>
|
||||
{t('chat.add.topic.title')}
|
||||
</AddButton>
|
||||
<div className="my-1"></div>
|
||||
</>
|
||||
}>
|
||||
{(topic) => {
|
||||
const isActive = topic.id === activeTopic?.id
|
||||
|
||||
@ -60,9 +60,7 @@ const UnifiedAddButton: FC<UnifiedAddButtonProps> = ({ onCreateAssistant, setAct
|
||||
|
||||
return (
|
||||
<div className="mb-1">
|
||||
<AddButton onPress={handleAddButtonClick} className="-mt-[1px] mb-[2px]">
|
||||
{t('chat.add.assistant.title')}
|
||||
</AddButton>
|
||||
<AddButton onClick={handleAddButtonClick}>{t('chat.add.assistant.title')}</AddButton>
|
||||
<AgentModal isOpen={isAgentModalOpen} onClose={onAgentModalClose} afterSubmit={afterCreate} />
|
||||
</div>
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user