Skip to content

Commit ff5eecd

Browse files
committed
modified: src/app/_components/carousel.tsx
modified: src/app/_components/tag.tsx modified: src/app/_components/tagAction.tsx modified: src/app/blog/page.tsx
1 parent 6141f09 commit ff5eecd

4 files changed

Lines changed: 50 additions & 23 deletions

File tree

src/app/_components/carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'slick-carousel/slick/slick-theme.css';
88
const Carousel = ({children}:React.PropsWithChildren) => {
99
const settings = {
1010
infinite: true,
11-
slidesToShow: 2,
11+
slidesToShow: 1,
1212
slidesToScroll: 1,
1313
autoplay: true,
1414
autoplaySpeed: 2000,

src/app/_components/tag.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import React from 'react';
66
type Props = {
77
label: string;
88
color:string;
9-
slug: string;
109
Close?: any;
1110
};
12-
export function handleClose(label:string) {
11+
export function handleClose(label?:string) {
1312
console.log(`Tag "${label}" closed!`);
1413
// Lakukan operasi server di sini, seperti memanggil API atau mengakses database.
1514
}
@@ -19,6 +18,7 @@ export const Tag = ({ label, color = 'bg-blue-500', Close }:Props) => {
1918
if (Close) {
2019
Close(label);
2120
}
21+
2222
};
2323

2424

src/app/_components/tagAction.tsx

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
1+
"use client"
2+
13
import {Tag,handleClose} from "@/app/_components/tag"
24

3-
type Props = {
5+
interface Tags {
46
label: string;
5-
color:string;
6-
slug: string;
7-
Close?: any;
8-
};
9-
10-
export default function TagRelease(props:Props[]){
11-
return(
12-
<div>
13-
{props.map(Tag)}
14-
</div>)
15-
}
7+
color: string;
8+
Close?:any;
9+
}
10+
11+
interface TagActionProps {
12+
tags: Tags[];
13+
}
14+
15+
16+
export default function TagAction(props:TagActionProps){
17+
if(!props.tags)return;
18+
return (
19+
<div>
20+
{props.tags.map((tag,i) => (
21+
22+
<Tag
23+
key={i}
24+
label={tag.label}
25+
color={tag.color}
26+
Close={handleClose}
27+
/>
28+
))
29+
}
30+
</div>
31+
);
32+
};

src/app/blog/page.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@ import { HeroPost } from "@/app/_components/hero-post";
33
import { Intro } from "@/app/_components/intro";
44
import { MoreStories } from "@/app/_components/more-stories";
55
import { getAllPosts } from "@/lib/api";
6-
// import { handleClose } from '@/app/_components/tagAction';
6+
// import TagAction from '@/app/_components/tagAction';
7+
8+
// interface Tag {
9+
// label: string;
10+
// color: string;
11+
// Close?:any;
12+
// }
13+
14+
// interface TagActionProps {
15+
// tags: Tag[];
16+
// }
17+
718

819
export default function Index() {
920
const allPosts = getAllPosts();
1021
const heroPost = allPosts[0];
1122
const morePosts = allPosts.slice(1);
1223
/* edit */
13-
const label = allPosts.map(lbl=>lbl.title)
14-
const color = ""
15-
console.log(label[0])
24+
//const Label= allPosts.map(lbl=>lbl.title)
25+
26+
1627

1728
return (
1829
<main>
@@ -27,10 +38,9 @@ export default function Index() {
2738
excerpt={heroPost.excerpt}
2839
/>
2940
{morePosts.length > 0 && <MoreStories posts={morePosts} />}
30-
{/* <Tag
31-
label={label}
32-
color={color?"bg-blue-500": ""}
33-
Close={()=>handleClose(label)}
41+
{/* <TagAction
42+
tags={Label}
43+
3444
/> */}
3545
</Container>
3646
</main>

0 commit comments

Comments
 (0)