Skip to content

Commit

Permalink
Merge pull request #44 from linqiqi077/main
Browse files Browse the repository at this point in the history
style: Update agent list Style
  • Loading branch information
Carrotzpc authored Mar 12, 2024
2 parents dc3ea9e + 7ff1ba2 commit a119420
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
2 changes: 1 addition & 1 deletion messages/en/components.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
index: {
faXianAIZhi: 'Discover AI Agents',
faXianAIZhi: 'Discover Agents',
dengLu: 'Login',
tuiJian: 'Recommend',
},
Expand Down
2 changes: 1 addition & 1 deletion messages/zh/components.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
index: {
faXianAIZhi: '发现 AI 智能体',
faXianAIZhi: '发现智能体',
dengLu: '登录',
tuiJian: '推荐',
},
Expand Down
5 changes: 2 additions & 3 deletions src/app/[locale]/agent/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTranslations } from 'next-intl';
// import { useRouter } from 'next/navigation';
import React, { useEffect, useState } from 'react';

import ReturnBtn from '@/components/ReturnBtn';
import TitleCom from '@/components/Title';

import TagContent from './TagContent';
import { useStyles } from './styles';
Expand Down Expand Up @@ -68,11 +68,10 @@ const Agent = React.memo<AgentProps>(({ agentData }) => {
return (
<div className={styles.agentContainer}>
<div className={styles.agentContent}>
<ReturnBtn
<TitleCom
extra={<Button>{t('index.dengLu')}</Button>}
isLeftTitle
title={t('index.faXianAIZhi')}
to="/chat"
/>
<div>
<div className={styles.main}>
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/agent/components/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const useStyles = createStyles(({ token, isDarkMode }) => ({
overflow: 'hidden',
textOverflow: 'ellipsis',
fontWeight: 700,
color: `${isDarkMode ? '#fff' : '#000'}`,
},
desc: {
color: token.colorTextDescription,
Expand Down
59 changes: 59 additions & 0 deletions src/components/Title/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use client';

import { Flex } from 'antd';
import { createStyles } from 'antd-style';
import React from 'react';

export const useStyles = createStyles(() => ({
TitleCom: {
padding: '0 24px',
height: '64px',
position: 'absolute',
top: 0,
width: '100%',
zIndex: 9,
overflowY: 'auto',
},
title: {
flex: '1 1',
alignItems: 'center',
display: 'flex',
fontWeight: 590,
fontSize: 16,
flexDirection: 'column',
marginLeft: '-40px',
},
leftTitle: {
fontWeight: 590,
fontSize: 16,
},
layout: {
width: '100%',
},
}));

interface TitleComProps {
to?: string;
title?: string;
isLeftTitle?: boolean;
extra?: React.ReactNode;
}

const TitleCom = React.memo<TitleComProps>(props => {
const { extra, isLeftTitle } = props;
const { styles } = useStyles();
return (
<Flex align={'center'} className={styles.TitleCom}>
{isLeftTitle ? (
<Flex align="center" className={styles.layout} justify="space-between">
<div className={styles.leftTitle}>{props.title}</div>
{extra}
</Flex>
) : (
<div className={styles.title}>{props.title}</div>
)}
</Flex>
);
});

export default TitleCom;

0 comments on commit a119420

Please sign in to comment.