fix: share props type for SessionNotificationCount

pull/2996/head
Audric Ackermann 1 year ago
parent 379ef2977a
commit 9ee3286f7a

@ -2,6 +2,8 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
type Props = { type Props = {
overflowingAt: number;
centeredOnTop: boolean;
count?: number; count?: number;
}; };
const StyledCountContainer = styled.div<{ centeredOnTop: boolean }>` const StyledCountContainer = styled.div<{ centeredOnTop: boolean }>`
@ -39,11 +41,7 @@ const OverflowingAt = (props: { overflowingAt: number }) => {
); );
}; };
const NotificationOrUnreadCount = ({ const NotificationOrUnreadCount = ({ centeredOnTop, overflowingAt, count }: Props) => {
centeredOnTop,
overflowingAt,
count,
}: Props & { overflowingAt: number; centeredOnTop: boolean }) => {
if (!count) { if (!count) {
return null; return null;
} }
@ -58,10 +56,10 @@ const NotificationOrUnreadCount = ({
); );
}; };
export const SessionNotificationCount = (props: Props) => { export const SessionNotificationCount = (props: Pick<Props, 'count'>) => {
return <NotificationOrUnreadCount centeredOnTop={false} overflowingAt={99} count={props.count} />; return <NotificationOrUnreadCount centeredOnTop={false} overflowingAt={99} count={props.count} />;
}; };
export const SessionUnreadCount = (props: Props) => { export const SessionUnreadCount = (props: Pick<Props, 'count'>) => {
return <NotificationOrUnreadCount centeredOnTop={true} overflowingAt={999} count={props.count} />; return <NotificationOrUnreadCount centeredOnTop={true} overflowingAt={999} count={props.count} />;
}; };

Loading…
Cancel
Save