Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Update agent list Style #44

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading