perf: new chat modal

This commit is contained in:
archer
2023-05-08 14:19:28 +08:00
parent d351084688
commit f20a5fe9a6
3 changed files with 22 additions and 9 deletions

View File

@@ -115,14 +115,22 @@ const PcSliderBar = ({
</Button>
{models.length > 1 && (
<Box
className={styles.modelList}
className={styles.modelListContainer}
position={'absolute'}
transition={'0.15s ease-out'}
w={'110%'}
left={0}
top={'45px'}
top={'40px'}
transition={'0.15s ease-out'}
bg={'white'}
>
<ModelList models={models} modelId={modelId} />
<Box
className={styles.modelList}
mt={'6px'}
h={'calc(100% - 6px)'}
overflow={'overlay'}
>
<ModelList models={models} modelId={modelId} />
</Box>
</Box>
)}
</Box>

View File

@@ -7,7 +7,7 @@ const ModelList = ({ models, modelId }: { models: ModelListItemType[]; modelId:
const router = useRouter();
return (
<Box w={'100%'} h={'100%'} bg={'white'} overflow={'overlay'}>
<>
{models.map((item) => (
<Box key={item._id}>
<Flex
@@ -18,6 +18,7 @@ const ModelList = ({ models, modelId }: { models: ModelListItemType[]; modelId:
cursor={'pointer'}
transition={'background-color .2s ease-in'}
borderLeft={['', '5px solid transparent']}
zIndex={0}
_hover={{
backgroundColor: ['', '#dee0e3']
}}
@@ -50,7 +51,7 @@ const ModelList = ({ models, modelId }: { models: ModelListItemType[]; modelId:
</Flex>
</Box>
))}
</Box>
</>
);
};

View File

@@ -11,14 +11,18 @@
}
.newChat {
.modelList {
.modelListContainer {
height: 0;
border-radius: 6px;
overflow: hidden;
}
.modelList {
border-radius: 6px;
}
&:hover {
.modelListContainer {
height: 60vh;
}
.modelList {
height: 50vh;
box-shadow: 0 0 5px rgba($color: #000000, $alpha: 0.05);
border: 1px solid #dee0e2;
}