-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
337fc3a
commit d51430b
Showing
38 changed files
with
907 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import Flex from './Flex'; | ||
import { Button, Divider, Typography, theme } from 'antd'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
|
||
interface StartItemContentProps { | ||
title: string; | ||
description?: string; | ||
icon?: React.ReactNode; | ||
buttonText: string; | ||
onClick?: () => void; | ||
themeColor?: string; | ||
iconBgColor?: string; | ||
} | ||
|
||
const ActionItemContent: React.FC<StartItemContentProps> = ({ | ||
title, | ||
description, | ||
icon, | ||
buttonText, | ||
onClick, | ||
themeColor, | ||
iconBgColor, | ||
}) => { | ||
const { token } = theme.useToken(); | ||
const [needScroll, setNeedScroll] = useState<boolean>(false); | ||
const containerRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
const handleResize = () => { | ||
if (containerRef.current) { | ||
const { clientWidth } = containerRef.current; | ||
// Currently, the minimum width for non-scrollable content is 220px (Start an Interactive Session Card) | ||
if (clientWidth <= 225) { | ||
setNeedScroll(true); | ||
} else { | ||
setNeedScroll(false); | ||
} | ||
} | ||
}; | ||
handleResize(); | ||
window.addEventListener('resize', handleResize); | ||
return () => { | ||
window.removeEventListener('resize', handleResize); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Flex | ||
ref={containerRef} | ||
align="center" | ||
justify="between" | ||
direction="column" | ||
style={{ | ||
height: '100%', | ||
textAlign: 'center', | ||
overflowY: 'scroll', | ||
//TODO: This is a temporary fix for the padding issue. It should be served from BAIBoard. | ||
paddingTop: token.marginMD, | ||
}} | ||
> | ||
<Flex direction="column" gap={token.marginSM}> | ||
<Flex | ||
align="center" | ||
justify="center" | ||
style={{ | ||
borderRadius: 25, | ||
width: 50, | ||
height: 50, | ||
//TODO: This is a temporary default background color for the icon. It should be served as a token. | ||
backgroundColor: iconBgColor ? iconBgColor : token['green-1'], | ||
}} | ||
> | ||
{icon} | ||
</Flex> | ||
<Flex style={{ minHeight: 60 }}> | ||
<Typography.Text | ||
strong | ||
style={{ | ||
fontSize: token.fontSizeHeading4, | ||
color: themeColor ? themeColor : token.colorPrimary, | ||
}} | ||
> | ||
{title} | ||
</Typography.Text> | ||
</Flex> | ||
<Typography.Text | ||
type="secondary" | ||
style={{ fontSize: token.fontSizeSM }} | ||
> | ||
{!needScroll && description} | ||
</Typography.Text> | ||
</Flex> | ||
<Flex direction="column" style={{ width: '100%' }}> | ||
{description && ( | ||
<Divider style={{ margin: token.marginSM, borderWidth: 2 }} /> | ||
)} | ||
<Flex style={{ width: '100%', padding: `0 ${token.paddingMD}px` }}> | ||
<Button | ||
type="primary" | ||
style={{ | ||
width: '100%', | ||
height: 40, | ||
backgroundColor: themeColor ? themeColor : token.colorPrimary, | ||
}} | ||
onClick={onClick} | ||
> | ||
<Typography.Text | ||
style={{ | ||
fontSize: token.fontSizeHeading5, | ||
color: token.colorWhite, | ||
}} | ||
> | ||
{buttonText} | ||
</Typography.Text> | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default ActionItemContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 0 additions & 92 deletions
92
react/src/components/SummaryPageItems/SummaryItemDownloadApp.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.