mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-18 22:53:28 +08:00
修复了模型卡片不等高的问题
This commit is contained in:
@@ -9,9 +9,9 @@ const StyledLabel = styled('div')<StyledLabelProps>(
|
||||
// 获取颜色值
|
||||
const getColor = (colorProp: string) => {
|
||||
// 如果是主题预设颜色
|
||||
if (['success', 'warning', 'error', 'info'].includes(colorProp)) {
|
||||
if (['success', 'warning', 'error', 'info', 'disabled'].includes(colorProp)) {
|
||||
return theme.palette[
|
||||
colorProp as 'success' | 'warning' | 'error' | 'info'
|
||||
colorProp as 'success' | 'warning' | 'error' | 'info' | 'disabled'
|
||||
].main;
|
||||
}
|
||||
// 如果是 default,使用灰色
|
||||
@@ -26,10 +26,10 @@ const StyledLabel = styled('div')<StyledLabelProps>(
|
||||
|
||||
// 获取背景颜色(淡化版本)
|
||||
const getBackgroundColor = (colorProp: string) => {
|
||||
if (['success', 'warning', 'error', 'info'].includes(colorProp)) {
|
||||
if (['success', 'warning', 'error', 'info', 'disabled'].includes(colorProp)) {
|
||||
// 使用主题的 light 版本,如果没有则使用 alpha 透明度
|
||||
const palette =
|
||||
theme.palette[colorProp as 'success' | 'warning' | 'error' | 'info'];
|
||||
theme.palette[colorProp as 'success' | 'warning' | 'error' | 'info' | 'disabled'];
|
||||
return alpha(palette.main, 0.15);
|
||||
}
|
||||
// 如果是 default,使用淡灰色背景
|
||||
|
||||
@@ -194,9 +194,7 @@ const ModelItem = ({
|
||||
sx={{ mt: 2 }}
|
||||
>
|
||||
<Stack direction='row' alignItems='center'>
|
||||
{data.is_active && (
|
||||
<StyledLabel color='success'>正在使用</StyledLabel>
|
||||
)}
|
||||
<StyledLabel color={data.is_active ? 'success' : 'disabled'}>{data.is_active ? '正在使用' : '未激活'}</StyledLabel>
|
||||
</Stack>
|
||||
<Stack direction='row' sx={{ button: { minWidth: 0 } }} gap={2}>
|
||||
{!data.is_active && (
|
||||
@@ -204,6 +202,9 @@ const ModelItem = ({
|
||||
disableRipple
|
||||
sx={{
|
||||
color: 'success.main',
|
||||
'&:hover': {
|
||||
fontWeight: 700
|
||||
},
|
||||
}}
|
||||
onClick={onActiveModel}
|
||||
>
|
||||
@@ -216,6 +217,9 @@ const ModelItem = ({
|
||||
disableRipple
|
||||
sx={{
|
||||
color: 'info.main',
|
||||
'&:hover': {
|
||||
fontWeight: 700
|
||||
},
|
||||
}}
|
||||
onClick={() => onEdit(data)}
|
||||
>
|
||||
@@ -228,6 +232,9 @@ const ModelItem = ({
|
||||
disableRipple
|
||||
sx={{
|
||||
color: 'error.main',
|
||||
'&:hover': {
|
||||
fontWeight: 700
|
||||
},
|
||||
}}
|
||||
onClick={onInactiveModel}
|
||||
>
|
||||
@@ -240,6 +247,9 @@ const ModelItem = ({
|
||||
disableRipple
|
||||
sx={{
|
||||
color: 'error.main',
|
||||
'&:hover': {
|
||||
fontWeight: 700
|
||||
},
|
||||
}}
|
||||
onClick={onRemoveModel}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user