Skip to content

Commit 336caa0

Browse files
committed
feat: setup basic component structure
1 parent 0b767fd commit 336caa0

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ module.exports = {
2828
'react/require-default-props': 'off',
2929
'react/jsx-fragments': ['error', 'element'],
3030
'react/no-unknown-property': ['error', { ignore: ['css'] }],
31+
'react/jsx-props-no-spreading': 'off',
3132
},
3233
};

src/components/Timeline.stories.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import { Timeline } from './Timeline';
33

44
<Meta title="Timeline" component={Timeline} />
55

6-
<Timeline />
6+
<Timeline items={[{ title: 'test', date: new Date() }]} />

src/components/Timeline.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
export function Timeline() {
2-
return <p>working</p>;
1+
import { TimelineItem, TimelineItemProps } from './TimelineItem';
2+
3+
export type TimelineProps = {
4+
items: TimelineItemProps[];
5+
};
6+
7+
export function Timeline({ items }: TimelineProps) {
8+
return items.map((item) => <TimelineItem key={item.date.toISOString()} {...item} />);
39
}

src/components/TimelineItem.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { PropsWithChildren } from 'react';
2+
3+
export type TimelineItemProps = PropsWithChildren<{
4+
className?: string;
5+
date: Date;
6+
title: string;
7+
}>;
8+
9+
export function TimelineItem({ className, title, date, children }: TimelineItemProps) {
10+
return (
11+
<div className={className}>
12+
<p>{date.toISOString()}</p>
13+
<p>{title}</p>
14+
{children}
15+
</div>
16+
);
17+
}

0 commit comments

Comments
 (0)