Skip to content

Commit f1a69c7

Browse files
committed
feat: 信息配置
1 parent 33c2a11 commit f1a69c7

File tree

4 files changed

+60
-41
lines changed

4 files changed

+60
-41
lines changed

config/about.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
export const heroTitle = {
2+
template: [
3+
{
4+
type: 'h1',
5+
text: `Hi , I'm `,
6+
class: ' font-light text-4xl font-900 inline-block',
7+
},
8+
{ type: 'h1', text: `zw`, class: ' text-4xl font-bold inline-block' },
9+
{
10+
type: 'h1',
11+
text: `👋`,
12+
class:
13+
' font-light text-4xl font-bold inline-block hover:scale-[1.05] cursor-pointer origin-center transition-all',
14+
},
15+
{ type: 'h1', text: ` `, class: ' h-0 w-0 scale-0' },
16+
{
17+
type: 'span',
18+
text: 'A ',
19+
class: 'font-light text-4xl font-900 inline-block mt-[5px]',
20+
},
21+
{
22+
type: 'span',
23+
text: ' JavaScript ',
24+
class: 'font-light text-4xl font-900 inline-block mt-[5px]',
25+
},
26+
{
27+
type: 'code',
28+
text: '<Learner />',
29+
class:
30+
' inline-block font-medium mx-2 text-3xl rounded p-2 bg-gray-200 dark:bg-gray-800/0 hover:dark:bg-gray-800/100 bg-opacity-0 hover:bg-opacity-100 transition-background duration-200',
31+
},
32+
],
33+
};
34+
35+
export const heroDesc = 'coding with love.';
36+
37+
export const heroOwnerInfo = {
38+
avatar: '/image/owner.jpg',
39+
socialIds: {
40+
github: 'coderz-w',
41+
bilibili: '515746437',
42+
qq: '3331598351',
43+
netease: '8257705181',
44+
},
45+
};

config/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export { seo } from './seo';
22
export { friendsList } from './friends';
33
export { projectList } from './projects';
4+
export { heroDesc, heroOwnerInfo, heroTitle } from './about';
45

56
export type { FriendModel } from './friends';
67
export type { ProjectModel } from './projects';

src/components/modules/home/Hero/Hero.tsx

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,13 @@ import { SocialIcon } from '../SocialIcon';
99
import { TextUpTransitionView } from '@/components/ui/transition/TextUpTransitionView';
1010
import { cn } from '@/lib/helper';
1111
import { TwoColumnLayout } from '@/components/layout/TwoColumnLayout';
12+
import { heroDesc, heroOwnerInfo, heroTitle } from '~/about';
1213

1314
export const Hero = () => {
14-
const title = {
15-
template: [
16-
{ type: 'h1', text: `Hi, I'm `, class: ' font-light text-4xl font-900 inline-block' },
17-
{ type: 'h1', text: `zw`, class: ' text-4xl font-bold inline-block' },
18-
{
19-
type: 'h1',
20-
text: `👋`,
21-
class:
22-
' font-light text-4xl font-bold inline-block hover:scale-[1.05] cursor-pointer origin-center transition-all',
23-
},
24-
{ type: 'h1', text: ` `, class: ' h-0 w-0 scale-0' },
25-
{
26-
type: 'span',
27-
text: 'A NodeJS Full Stack ',
28-
class: 'font-light text-4xl font-900 inline-block mt-[5px]',
29-
},
30-
{
31-
type: 'code',
32-
text: '<Developer />',
33-
class:
34-
' inline-block font-medium mx-2 text-3xl rounded p-2 bg-gray-200 dark:bg-gray-800/0 hover:dark:bg-gray-800/100 bg-opacity-0 hover:bg-opacity-100 transition-background duration-200"><div><span class="inline-block whitespace-pre',
35-
},
36-
],
37-
};
38-
39-
const description = 'An independent developer coding with love.';
40-
41-
const siteOwner = {
42-
avatar: '/image/owner.jpg',
43-
socialIds: {
44-
github: 'https://github.com/yangxuanxuan1998',
45-
twitter: 'https://twitter.com/yangxuanxuan1998',
46-
},
47-
};
48-
49-
const { avatar, socialIds } = siteOwner;
15+
const { avatar, socialIds } = heroOwnerInfo;
5016

5117
const titleAnimateD =
52-
title.template.reduce((acc, cur) => {
18+
heroTitle.template.reduce((acc, cur) => {
5319
return acc + (cur.text?.length || 0);
5420
}, 0) * 50;
5521

@@ -63,10 +29,10 @@ export const Hero = () => {
6329
animate={{ y: 0, opacity: 1 }}
6430
transition={{ type: 'spring', damping: 10, stiffness: 100 }}
6531
>
66-
{title.template.map((t, i) => {
32+
{heroTitle.template.map((t, i) => {
6733
const { type, text, class: className } = t;
6834

69-
const prevAllTextLength = title.template.slice(0, i).reduce((acc, cur) => {
35+
const prevAllTextLength = heroTitle.template.slice(0, i).reduce((acc, cur) => {
7036
return acc + (cur.text?.length || 0);
7137
}, 0);
7238

@@ -93,7 +59,7 @@ export const Hero = () => {
9359
}}
9460
className="my-3 text-center lg:text-left lg:ml-24"
9561
>
96-
<span className=" opacity-70"> {description}</span>
62+
<span className=" opacity-70"> {heroDesc}</span>
9763
</m.div>
9864

9965
<ul className="center mx-[60px] mt-8 flex flex-wrap gap-6 lg:mx-auto lg:mt-24 lg:justify-start lg:gap-4 lg:ml-24">

src/components/modules/home/SocialIcon/SocialIcon.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,19 @@ export const SocialIcon = memo((props: SocialIconProps) => {
7979
type="tooltip"
8080
triggerElement={
8181
<MotionButtonBase
82+
aria-label={`${name}-icon`}
8283
className="center flex aspect-square size-10 rounded-full text-2xl text-white"
8384
style={{
8485
background: iconBg,
8586
}}
8687
>
87-
<a target="_blank" href={href} className="center flex" rel="noreferrer">
88+
<a
89+
target="_blank"
90+
aria-label={`${name}-link`}
91+
href={href}
92+
className="center flex"
93+
rel="noreferrer"
94+
>
8895
{Icon}
8996
</a>
9097
</MotionButtonBase>

0 commit comments

Comments
 (0)