Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f0a4d0

Browse files
iamfaranraheeliftikhar5
authored andcommitted
replace shadcn dialog with antD modal
1 parente101e9b commit0f0a4d0

File tree

2 files changed

+29
-265
lines changed

2 files changed

+29
-265
lines changed

‎client/packages/lowcoder/src/comps/comps/chatComp/components/ui/attachment.tsx‎

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,20 @@ import {
99
useAttachment,
1010
}from"@assistant-ui/react";
1111
importstyledfrom"styled-components";
12+
import{Modal}from"antd";
1213
import{
1314
Tooltip,
1415
TooltipContent,
1516
TooltipTrigger,
1617
}from"./tooltip";
17-
import{
18-
Dialog,
19-
DialogTitle,
20-
DialogTrigger,
21-
DialogOverlay,
22-
DialogPortal,
23-
DialogContent,
24-
}from"./dialog";
2518
import{Avatar,AvatarImage,AvatarFallback}from"./avatar";
2619
import{TooltipIconButton}from"../assistant-ui/tooltip-icon-button";
2720

2821
// ============================================================================
2922
// STYLED COMPONENTS
3023
// ============================================================================
3124

32-
constStyledDialogTrigger=styled(DialogTrigger)`
25+
constStyledModalTrigger=styled.div`
3326
cursor: pointer;
3427
transition: background-color 0.2s;
3528
padding: 2px;
@@ -136,13 +129,7 @@ const StyledComposerButton = styled(TooltipIconButton)`
136129
transition: opacity 0.2s ease-in;
137130
`;
138131

139-
constScreenReaderOnly=styled.span`
140-
position: absolute;
141-
left: -10000px;
142-
width: 1px;
143-
height: 1px;
144-
overflow: hidden;
145-
`;
132+
// ScreenReaderOnly component removed as it's no longer needed with ANTD Modal
146133

147134

148135
constuseAttachmentSrc=()=>{
@@ -244,21 +231,37 @@ const AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {
244231

245232
constAttachmentPreviewDialog:FC<PropsWithChildren>=({ children})=>{
246233
constsrc=useAttachmentSrc();
234+
const[isModalOpen,setIsModalOpen]=useState(false);
247235

248236
if(!src)return<>{children}</>;
249237

250238
return(
251-
<Dialog>
252-
<StyledDialogTriggerasChild>
239+
<>
240+
<StyledModalTriggeronClick={()=>setIsModalOpen(true)}>
253241
{children}
254-
</StyledDialogTrigger>
255-
<AttachmentDialogContent>
256-
<DialogTitle>
257-
<ScreenReaderOnly>Image Attachment Preview</ScreenReaderOnly>
258-
</DialogTitle>
242+
</StyledModalTrigger>
243+
<Modal
244+
title="Image Attachment Preview"
245+
open={isModalOpen}
246+
onCancel={()=>setIsModalOpen(false)}
247+
footer={null}
248+
width="auto"
249+
style={{
250+
maxWidth:"80vw",
251+
top:20,
252+
}}
253+
styles={{
254+
body:{
255+
display:"flex",
256+
justifyContent:"center",
257+
alignItems:"center",
258+
padding:"20px",
259+
}
260+
}}
261+
>
259262
<AttachmentPreviewsrc={src}/>
260-
</AttachmentDialogContent>
261-
</Dialog>
263+
</Modal>
264+
</>
262265
);
263266
};
264267

@@ -363,13 +366,4 @@ export const ComposerAddAttachment: FC = () => {
363366
</StyledComposerButton>
364367
</ComposerPrimitive.AddAttachment>
365368
);
366-
};
367-
368-
constAttachmentDialogContent:FC<PropsWithChildren>=({ children})=>(
369-
<DialogPortal>
370-
<DialogOverlay/>
371-
<DialogContentclassName="aui-dialog-content">
372-
{children}
373-
</DialogContent>
374-
</DialogPortal>
375-
);
369+
};

‎client/packages/lowcoder/src/comps/comps/chatComp/components/ui/dialog.tsx‎

Lines changed: 0 additions & 230 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp