Files
liqa/client/.storybook/stories/Timestamp.stories.tsx
T
ars9 32beec2229 feat(client): add Timestamp component, ESLint 10 + Prettier, and code quality fixes
- add Timestamp component with moment relative time and ISO tooltip
- add Timestamp stories (JustNow, MinutesAgo, HoursAgo, DaysAgo, MonthsAgo)
- add ESLint 10 with typescript-eslint, react-hooks, react-refresh, prettier
- add Prettier config with singleQuote, semi, trailingComma all, printWidth 100
- add lint, lint:fix, format, test:storybook scripts to package.json
- fix react-hooks/set-state-in-effect in all page components
- auto-fix 113 Prettier formatting issues across src and .storybook
2026-04-09 10:25:15 +03:00

22 lines
920 B
TypeScript

import type { Meta, StoryObj } from '@storybook/react-vite';
import { Timestamp } from '../../src/ui/Timestamp/Timestamp';
const meta: Meta<typeof Timestamp> = {
title: 'UI/Timestamp',
component: Timestamp,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof Timestamp>;
const minutesAgo = (n: number) => new Date(Date.now() - n * 60_000).toISOString();
const hoursAgo = (n: number) => new Date(Date.now() - n * 3_600_000).toISOString();
const daysAgo = (n: number) => new Date(Date.now() - n * 86_400_000).toISOString();
export const JustNow: Story = { args: { value: minutesAgo(1) } };
export const MinutesAgo: Story = { args: { value: minutesAgo(15) } };
export const HoursAgo: Story = { args: { value: hoursAgo(3) } };
export const DaysAgo: Story = { args: { value: daysAgo(5) } };
export const MonthsAgo: Story = { args: { value: daysAgo(90) } };