Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: component props #1265

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/AccountNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ import {
ChevronLeftIcon,
ChevronUpIcon,
} from '@primer/octicons-react';
import { useState } from 'react';
import { type FC, useState } from 'react';
import type { Account } from '../types';
import type { Notification } from '../typesGitHub';
import { openAccountProfile } from '../utils/links';
import { RepositoryNotifications } from './Repository';
import { PlatformIcon } from './icons/PlatformIcon';

interface IProps {
interface IAccountNotifications {
account: Account;
notifications: Notification[];
showAccountHostname: boolean;
}

export const AccountNotifications = (props: IProps) => {
export const AccountNotifications: FC<IAccountNotifications> = (
props: IAccountNotifications,
) => {
const { account, showAccountHostname, notifications } = props;

const groupedNotifications = Object.values(
Expand Down
4 changes: 2 additions & 2 deletions src/components/AllRead.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { type FC, useMemo } from 'react';
import { Constants } from '../utils/constants';

export const AllRead = () => {
export const AllRead: FC = () => {
const emoji = useMemo(
() =>
Constants.ALL_READ_EMOJIS[
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ArrowLeftIcon } from '@primer/octicons-react';
import type { ReactNode } from 'react';
import type { FC, ReactNode } from 'react';
import { useNavigate } from 'react-router-dom';

interface IHeader {
children: ReactNode;
}

export const Header = ({ children }: IHeader) => {
export const Header: FC<IHeader> = ({ children }: IHeader) => {
const navigate = useNavigate();
return (
<div className="mx-8 mt-2 flex items-center justify-between py-2">
Expand Down
4 changes: 2 additions & 2 deletions src/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import NProgress from 'nprogress';
import { useContext, useEffect } from 'react';
import { type FC, useContext, useEffect } from 'react';
import { AppContext } from '../context/App';

export const Loading = () => {
export const Loading: FC = () => {
const { status } = useContext(AppContext);

useEffect(() => {
Expand Down
11 changes: 9 additions & 2 deletions src/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
interface IProps {
import type { FC } from 'react';

interface ILogo {
isDark?: boolean;
onClick?: () => void;
className?: string;
Expand All @@ -10,7 +12,12 @@ const LIGHT_GRADIENT_END = '#FFFFFF';
const DARK_GRADIENT_START = '#22283B';
const DARK_GRADIENT_END = '#555B6E';

export const Logo = ({ isDark, onClick, className = '', ...props }: IProps) => (
export const Logo: FC<ILogo> = ({
isDark,
onClick,
className = '',
...props
}: ILogo) => (
<svg
className={className}
onClick={() => onClick?.()}
Expand Down
6 changes: 4 additions & 2 deletions src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ import { openNotification, openUserProfile } from '../utils/links';
import { formatReason } from '../utils/reason';
import { PillButton } from './buttons/PillButton';

interface IProps {
interface INotificationRow {
notification: Notification;
}

export const NotificationRow: FC<IProps> = ({ notification }) => {
export const NotificationRow: FC<INotificationRow> = ({
notification,
}: INotificationRow) => {
const {
settings,
removeNotificationFromState,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Oops.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { type FC, useMemo } from 'react';
import type { GitifyError } from '../types';

interface IProps {
interface IOops {
error: GitifyError;
}

export const Oops: FC<IProps> = ({ error }) => {
export const Oops: FC<IOops> = ({ error }: IOops) => {
const emoji = useMemo(
() => error.emojis[Math.floor(Math.random() * error.emojis.length)],
[error],
Expand Down
4 changes: 2 additions & 2 deletions src/components/Repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import type { Notification } from '../typesGitHub';
import { openRepository } from '../utils/links';
import { NotificationRow } from './NotificationRow';

interface IProps {
interface IRepositoryNotifications {
repoNotifications: Notification[];
repoName: string;
}

export const RepositoryNotifications: FC<IProps> = ({
export const RepositoryNotifications: FC<IRepositoryNotifications> = ({
repoName,
repoNotifications,
}) => {
Expand Down