<MessageTimestamp>
: make timestamp
prop required
This commit is contained in:
parent
26100ea562
commit
a3b1b696db
2 changed files with 3 additions and 7 deletions
|
@ -41,7 +41,7 @@ const times = (): Array<[string, number]> => [
|
||||||
|
|
||||||
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||||
i18n,
|
i18n,
|
||||||
timestamp: overrideProps.timestamp,
|
timestamp: overrideProps.timestamp || Date.now(),
|
||||||
now: Date.now(),
|
now: Date.now(),
|
||||||
module: text('module', ''),
|
module: text('module', ''),
|
||||||
withImageNoCaption: boolean('withImageNoCaption', false),
|
withImageNoCaption: boolean('withImageNoCaption', false),
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { Time } from '../Time';
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
now: number;
|
now: number;
|
||||||
timestamp?: number;
|
timestamp: number;
|
||||||
module?: string;
|
module?: string;
|
||||||
withImageNoCaption?: boolean;
|
withImageNoCaption?: boolean;
|
||||||
withSticker?: boolean;
|
withSticker?: boolean;
|
||||||
|
@ -30,13 +30,9 @@ export function MessageTimestamp({
|
||||||
withImageNoCaption,
|
withImageNoCaption,
|
||||||
withSticker,
|
withSticker,
|
||||||
withTapToViewExpired,
|
withTapToViewExpired,
|
||||||
}: Readonly<Props>): null | ReactElement {
|
}: Readonly<Props>): ReactElement {
|
||||||
const moduleName = module || 'module-timestamp';
|
const moduleName = module || 'module-timestamp';
|
||||||
|
|
||||||
if (timestamp === null || timestamp === undefined) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Time
|
<Time
|
||||||
className={classNames(
|
className={classNames(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue