-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement time rendering logic and add stories
- Loading branch information
1 parent
d5bdc51
commit 6c9d375
Showing
2 changed files
with
73 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { RelativeTime } from './RelativeTime'; | ||
|
||
const meta = { | ||
component: RelativeTime, | ||
args: { | ||
testCount: 42, | ||
}, | ||
} satisfies Meta<typeof RelativeTime>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const JustNow: Story = { | ||
args: { | ||
timestamp: new Date(), | ||
}, | ||
}; | ||
|
||
export const SecondsAgo: Story = { | ||
args: { | ||
timestamp: new Date(Date.now() - 1000 * 15), | ||
}, | ||
}; | ||
|
||
export const MinutesAgo: Story = { | ||
args: { | ||
timestamp: new Date(Date.now() - 1000 * 60 * 2), | ||
}, | ||
}; | ||
|
||
export const HoursAgo: Story = { | ||
args: { | ||
timestamp: new Date(Date.now() - 1000 * 60 * 60 * 3), | ||
}, | ||
}; | ||
|
||
export const Yesterday: Story = { | ||
args: { | ||
timestamp: new Date(Date.now() - 1000 * 60 * 60 * 24), | ||
}, | ||
}; | ||
|
||
export const DaysAgo: Story = { | ||
args: { | ||
timestamp: new Date(Date.now() - 1000 * 60 * 60 * 24 * 3), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters