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
This commit is contained in:
1 parent
50b942801f
commit
32beec2229
29 files changed
+1175
-280
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import moment from 'moment';
|
||||
import styles from './Timestamp.module.css';
|
||||
|
||||
export interface TimestampProps {
|
||||
value: string | number | Date;
|
||||
}
|
||||
|
||||
export function Timestamp({ value }: TimestampProps) {
|
||||
const m = moment(value);
|
||||
const iso = m.toISOString();
|
||||
const relative = m.fromNow();
|
||||
|
||||
return (
|
||||
<span className={styles.timestamp} title={iso} aria-label={iso}>
|
||||
{relative}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user