Skip to content

Commit 86d78d3

Browse files
authored
Merge pull request #6 from cocdeshijie/master
Update Type Writer and Added Scroll Down for Hero Component
2 parents 3b144cc + 9fa13c1 commit 86d78d3

10 files changed

Lines changed: 105 additions & 54 deletions

File tree

components/hero/IconHero.tsx

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,54 @@ import { cn } from "@/lib/utils";
33
import { Typing } from "@/components/hero/typist/Typing";
44
import { blogConfig } from "@/config";
55
import Link from "next/link";
6+
import { ImQuotesLeft, ImQuotesRight } from "react-icons/im";
7+
import ScrollDown from "@/components/hero/components/ScrollDown";
68

79
const heroSetting = require("@/config").blogConfig.hero.settings
810

911
export default function IconHero() {
1012

1113
return (
12-
<div className={"grid content-center justify-items-center min-h-screen"}>
13-
<div className="w-36 h-36 mx-auto mb-3">
14-
<Image
15-
src={heroSetting.icon_path}
16-
alt="Profile Image"
17-
width={256}
18-
height={256}
19-
style={{ width: 'auto', height: '100%' }}
20-
className="object-cover hover:rotate-[360deg] duration-500"/>
21-
</div>
22-
<div className={"w-10/12 max-w-xl"}>
23-
<div className={cn(
24-
"backdrop-blur-sm drop-shadow-md w-full rounded-2xl text-center py-5",
25-
"bg-secondary_color/50 dark:bg-secondary_color-dark/50"
26-
)}>
27-
<Typing />
14+
<div className={"relative flex flex-col min-h-screen"}>
15+
<div className={"grid content-center justify-items-center flex-grow"}>
16+
<div className="w-36 h-36 mx-auto mb-3">
17+
<Image
18+
src={heroSetting.icon_path}
19+
alt="Icon Image"
20+
width={256}
21+
height={256}
22+
style={{ width: 'auto', height: '100%' }}
23+
className="object-cover hover:rotate-[360deg] duration-500"/>
2824
</div>
29-
</div>
30-
<div className="flex mt-5 space-x-3">
31-
{blogConfig.social.map((social) => {
32-
return (
33-
<Link href={social.href}
34-
key={social.title}
35-
className={cn(
36-
"backdrop-blur-sm drop-shadow rounded-xl w-8 h-8",
37-
"bg-secondary_color/70 dark:bg-secondary_color-dark/70"
38-
)}>
39-
<div className={"m-1"}>
40-
{social.icon}
41-
</div>
42-
</Link>
43-
);
44-
})}
25+
<div className={"w-10/12 max-w-xl"}>
26+
<div className={cn(
27+
"backdrop-blur-sm drop-shadow-md w-full rounded-2xl text-center py-5",
28+
"bg-secondary_color/50 dark:bg-secondary_color-dark/50"
29+
)}>
30+
<div className="flex justify-center items-center space-x-1 font-semibold">
31+
<ImQuotesLeft className={"w-4 h-4 mb-2"} />
32+
<Typing />
33+
<ImQuotesRight className={"w-4 h-4 mb-2"} />
34+
</div>
35+
</div>
36+
</div>
37+
<div className="flex mt-5 space-x-3">
38+
{blogConfig.social.map((social) => {
39+
return (
40+
<Link href={social.href}
41+
key={social.title}
42+
className={cn(
43+
"backdrop-blur-sm drop-shadow rounded-xl w-8 h-8",
44+
"bg-secondary_color/70 dark:bg-secondary_color-dark/70"
45+
)}>
46+
<div className={"m-1"}>
47+
{social.icon}
48+
</div>
49+
</Link>
50+
);
51+
})}
52+
</div>
53+
<ScrollDown />
4554
</div>
4655
</div>
4756
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use client";
2+
3+
import { GoChevronDown } from "react-icons/go";
4+
import { motion } from "framer-motion";
5+
import { cn } from "@/lib/utils";
6+
7+
export default function ScrollDown() {
8+
const scrollToNextSection = () => {
9+
window.scrollTo({
10+
top: window.innerHeight * 0.9,
11+
behavior: "smooth"
12+
});
13+
};
14+
15+
return (
16+
<div className={"absolute bottom-0 w-full flex justify-center pb-10"}>
17+
<motion.div
18+
animate={{
19+
y: [0, -5, 0]
20+
}}
21+
transition={{
22+
repeat: Infinity,
23+
repeatType: 'reverse',
24+
duration: 2
25+
}}
26+
>
27+
<button onClick={scrollToNextSection}
28+
className={cn(
29+
"backdrop-blur-[1px] rounded-3xl focus:outline-none",
30+
"text-accent_color dark:text-accent_color-dark opacity-60"
31+
)}>
32+
<GoChevronDown className="w-14 h-14" />
33+
</button>
34+
</motion.div>
35+
</div>
36+
)
37+
}

components/hero/typist/Typing.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
"use client"
22

3-
import Typist from "react-typist-component";
3+
import Typewriter from 'typewriter-effect';
44
import { blogConfig } from "@/config";
55

66

77
export function Typing() {
88

99
return (
10-
<Typist typingDelay={100}
11-
>
12-
<span>{blogConfig.typist}</span>
13-
</Typist>
10+
<Typewriter
11+
onInit={(typewriter) => {
12+
typewriter.typeString(blogConfig.typewriter).start();
13+
}}
14+
/>
1415
)
1516
}

config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const blogConfig: BlogConfig = {
1515
title: "Next Sakurairo",
1616
description: "A blog system made with Next.js.",
1717
author: "cocdeshijie",
18-
typist: "by cocdeshijie",
18+
typewriter: "by cocdeshijie",
1919
articles_per_load: 5,
2020

2121
navigation: [

config/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type BlogConfig = {
2929
* This will appear in front page typing component.
3030
* @example "by cocdeshijie"
3131
*/
32-
typist: string;
32+
typewriter: string;
3333

3434
/*
3535
* The number of articles per load.

content/articles/documentation/user-en-US.mdx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,39 @@ tags:
77
- Documentation
88
---
99

10-
## Blog URL
10+
## URL
1111
Set the URL of your blog. This should be a fully qualified domain name (FQDN) pointing to your site.
1212

13-
## Blog Title
13+
## Title
1414
This is the main title of your blog. It is often shown in the browser title bar and used as the default title for bookmarks.
1515

16-
## Blog Description
16+
## Description
1717
Provide a brief description of your blog. This description often appears in search engine results.
1818

1919
## Author
2020
Set the author's name. This will be used for meta.
2121

22-
## Typist
22+
## Type Writer
2323
Set the typist's text. This will appear in the front page typing component.
2424

2525
## Articles Per Load
2626
Define the number of articles to load for each fetch. For example, if you want to load 5 articles each time you fetch more articles, set this to 5.
2727

28-
## Navigation Bar
29-
Define your blog's navigation bar items, including the title of the navigation bar item and the href.
28+
## Navigation
29+
Define your blog's navigation items, including the title of the navigation item and the href.
30+
31+
## Header
32+
Define the header component to use.
33+
34+
### Floating Header
35+
Header will always float at top.
3036

3137
## Background Image
32-
Define the background image for your blog.
38+
Define the background image component for your blog.
3339

34-
### APIBackgroundImage
40+
### API Background Image
3541
If you choose the "APIBackgroundImage" option, you need to provide the URL and filter type (grid, dot, none).
36-
- _`url`_: Set the URL for the background image.
42+
- _`url`_: Set the URL for the background image. If not set, it will use local image api. Local images are at _`/public/image-api`_.
3743
- _`filter`_: Choose the filter for the background image. Available options are 'grid', 'dot', 'none'.
3844

3945
## Hero
@@ -59,13 +65,13 @@ For an image logo, you need to provide an _`image_path`_.
5965

6066
- _`image_path`_: Set the path of the image. If the logo image is in the public folder, the path should be "/logo.png". Make sure that the image exists at the specified path in your project.
6167

62-
## Social Media Links
68+
## Social
6369
Set the social media links that will appear in the front page landing screen. For each social media link, define the title, icon, and href.
6470

65-
## Theme Colors
71+
## Colors
6672
Define the color scheme for your blog. You can set the _`primary_color`_, _`secondary_color`_, and _`accent_color`_ for both light and dark modes.
6773

68-
## Comment Component
74+
## Comment
6975
Configure the comment component which will appear under each article. You have the option to use "GiscusComment". Check [https://giscus.app/](https://giscus.app/) on how to use it.
7076

7177
### Giscus Comment

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
"react": "18.2.0",
5151
"react-dom": "18.2.0",
5252
"react-icons": "^4.10.1",
53-
"react-typist-component": "^1.0.5",
5453
"rehype-autolink-headings": "^6.1.1",
5554
"rehype-slug": "^5.1.0",
5655
"remark-gfm": "^3.0.1",
5756
"swr": "^2.2.0",
5857
"tailwind-merge": "^1.12.0",
5958
"tailwindcss": "3.3.2",
6059
"typescript": "5.0.4",
60+
"typewriter-effect": "^2.20.1",
6161
"zustand": "^4.3.8"
6262
}
6363
}

public/img.png

285 KB
Loading

public/next.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/vercel.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)