* doc

* feat: navbar size

* navbar ui
This commit is contained in:
Archer
2024-12-12 17:54:38 +08:00
committed by GitHub
parent ddddd998c8
commit e71708ee76
7 changed files with 69 additions and 50 deletions

View File

@@ -121,44 +121,55 @@ const Navbar = ({ unread }: { unread: number }) => {
</Box>
{/* 导航列表 */}
<Box flex={1}>
{navbarList.map((item) => (
<Box
key={item.link}
{...itemStyles}
{...(item.activeLink.includes(router.pathname)
? {
color: 'primary.600',
bg: 'white',
boxShadow:
'0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 4px 4px 0px rgba(19, 51, 107, 0.05)'
}
: {
color: 'myGray.500',
bg: 'transparent',
_hover: {
bg: isSecondNavbarPage ? 'white' : 'rgba(255,255,255,0.9)'
{navbarList.map((item) => {
const isActive = item.activeLink.includes(router.pathname);
return (
<Box
key={item.link}
{...itemStyles}
{...(isActive
? {
bg: 'white',
boxShadow:
'0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 4px 4px 0px rgba(19, 51, 107, 0.05)'
}
})}
{...(item.link !== router.asPath
? {
onClick: () => router.push(item.link)
}
: {})}
>
<MyIcon
name={
item.activeLink.includes(router.pathname)
? (item.activeIcon as any)
: (item.icon as any)
}
width={'20px'}
height={'20px'}
/>
<Box fontSize={'12px'} transform={'scale(0.9)'} mt={'5px'} lineHeight={1}>
{item.label}
: {
bg: 'transparent',
_hover: {
bg: isSecondNavbarPage ? 'white' : 'rgba(255,255,255,0.9)'
}
})}
{...(item.link !== router.asPath
? {
onClick: () => router.push(item.link)
}
: {})}
>
<MyIcon
{...(isActive
? {
name: item.activeIcon as any,
color: 'primary.600'
}
: {
name: item.icon as any,
color: 'myGray.400'
})}
width={'20px'}
height={'20px'}
/>
<Box
fontSize={'12px'}
transform={'scale(0.9)'}
mt={'5px'}
lineHeight={1}
color={isActive ? 'primary.700' : 'myGray.500'}
>
{item.label}
</Box>
</Box>
</Box>
))}
);
})}
</Box>
{unread > 0 && (
@@ -191,10 +202,10 @@ const Navbar = ({ unread }: { unread: number }) => {
{...itemStyles}
{...hoverStyle}
mt={0}
color={'myGray.500'}
color={'myGray.400'}
height={'48px'}
>
<Avatar src={item.avatar} borderRadius={'md'} />
<Avatar src={item.avatar} borderRadius={'md'} width={'26px'} height={'26px'} />
</Link>
</MyTooltip>
))}
@@ -208,7 +219,7 @@ const Navbar = ({ unread }: { unread: number }) => {
{...itemStyles}
{...hoverStyle}
mt={0}
color={'myGray.500'}
color={'myGray.400'}
height={'48px'}
>
<MyIcon name={'common/gitInlight'} width={'26px'} height={'26px'} />

View File

@@ -121,7 +121,16 @@ const VariableInput = ({
const variablesForm = useContextSelector(ChatItemContext, (v) => v.variablesForm);
const variableList = useContextSelector(ChatBoxContext, (v) => v.variableList);
const { handleSubmit: handleSubmitChat } = variablesForm;
const { getValues, setValue, handleSubmit: handleSubmitChat } = variablesForm;
useEffect(() => {
variableList.forEach((item) => {
const val = getValues(`variables.${item.key}`);
if (item.defaultValue !== undefined && (val === undefined || val === null || val === '')) {
setValue(`variables.${item.key}`, item.defaultValue);
}
});
}, [variableList]);
return (
<Box py={3}>