Skip to content
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
6 changes: 3 additions & 3 deletions src/components/AccountNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@primer/octicons-react';
import { type FC, useContext, useState } from 'react';
import { AppContext } from '../context/App';
import type { Account } from '../types';
import { type Account, Size } from '../types';
import type { Notification } from '../typesGitHub';
import { openAccountProfile } from '../utils/links';
import { NotificationRow } from './NotificationRow';
Expand Down Expand Up @@ -68,7 +68,7 @@ export const AccountNotifications: FC<IAccountNotifications> = (
onClick={toggleAccountNotifications}
>
<div className="flex gap-3">
<PlatformIcon type={account.platform} size={16} />
<PlatformIcon type={account.platform} size={Size.MEDIUM} />
<button
type="button"
title="Open Profile"
Expand All @@ -85,7 +85,7 @@ export const AccountNotifications: FC<IAccountNotifications> = (
title={toggleAccountNotificationsLabel}
onClick={toggleAccountNotifications}
>
<ChevronIcon size={14} />
<ChevronIcon size={Size.SMALL} />
</button>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ArrowLeftIcon } from '@primer/octicons-react';
import type { FC, ReactNode } from 'react';
import { useNavigate } from 'react-router-dom';
import { Size } from '../types';

interface IHeader {
children: ReactNode;
Expand All @@ -17,7 +18,7 @@ export const Header: FC<IHeader> = ({ children }: IHeader) => {
onClick={() => navigate(-1)}
>
<ArrowLeftIcon
size={20}
size={Size.XLARGE}
className="hover:text-gray-400"
aria-label="Go Back"
/>
Expand Down
19 changes: 11 additions & 8 deletions src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
useState,
} from 'react';
import { AppContext } from '../context/App';
import { IconColor } from '../types';
import { IconColor, Size } from '../types';
import type { Notification } from '../typesGitHub';
import { cn } from '../utils/cn';
import {
Expand Down Expand Up @@ -126,7 +126,7 @@ export const NotificationRow: FC<INotificationRow> = ({
title={notificationTitle}
>
<NotificationIcon
size={groupByDate ? 20 : 16}
size={groupByDate ? Size.XLARGE : Size.MEDIUM}
aria-label={notification.subject.type}
/>
</div>
Expand All @@ -144,7 +144,7 @@ export const NotificationRow: FC<INotificationRow> = ({
<AvatarIcon
title={repoSlug}
url={repoAvatarUrl}
size="medium"
size={Size.SMALL}
defaultIcon={MarkGithubIcon}
/>
</span>
Expand Down Expand Up @@ -180,13 +180,13 @@ export const NotificationRow: FC<INotificationRow> = ({
<AvatarIcon
title={notification.subject.user.login}
url={notification.subject.user.avatar_url}
size="small"
size={Size.XSMALL}
defaultIcon={FeedPersonIcon}
/>
</button>
) : (
<div>
<FeedPersonIcon size={16} className={IconColor.GRAY} />
<FeedPersonIcon size={Size.MEDIUM} className={IconColor.GRAY} />
</div>
)}
<div title={reason.description}>{reason.title}</div>
Expand Down Expand Up @@ -261,7 +261,7 @@ export const NotificationRow: FC<INotificationRow> = ({
markNotificationDone(notification);
}}
>
<CheckIcon size={16} aria-label="Mark as Done" />
<CheckIcon size={Size.MEDIUM} aria-label="Mark as Done" />
</button>

<button
Expand All @@ -274,7 +274,7 @@ export const NotificationRow: FC<INotificationRow> = ({
markNotificationRead(notification);
}}
>
<ReadIcon size={14} aria-label="Mark as Read" />
<ReadIcon size={Size.SMALL} aria-label="Mark as Read" />
</button>

<button
Expand All @@ -283,7 +283,10 @@ export const NotificationRow: FC<INotificationRow> = ({
title="Unsubscribe from Thread"
onClick={unsubscribeFromThread}
>
<BellSlashIcon size={14} aria-label="Unsubscribe from Thread" />
<BellSlashIcon
size={Size.SMALL}
aria-label="Unsubscribe from Thread"
/>
</button>
</div>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/components/RepositoryNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@primer/octicons-react';
import { type FC, useCallback, useContext, useState } from 'react';
import { AppContext } from '../context/App';
import { Size } from '../types';
import type { Notification } from '../typesGitHub';
import { openRepository } from '../utils/links';
import { NotificationRow } from './NotificationRow';
Expand Down Expand Up @@ -59,7 +60,7 @@ export const RepositoryNotifications: FC<IRepositoryNotifications> = ({
<AvatarIcon
title={repoName}
url={avatarUrl}
size="medium"
size={Size.LARGE}
defaultIcon={MarkGithubIcon}
/>
<span
Expand All @@ -77,7 +78,10 @@ export const RepositoryNotifications: FC<IRepositoryNotifications> = ({
title="Mark Repository as Done"
onClick={markRepoAsDone}
>
<CheckIcon size={16} aria-label="Mark Repository as Done" />
<CheckIcon
size={Size.MEDIUM}
aria-label="Mark Repository as Done"
/>
</button>

<button
Expand All @@ -86,7 +90,7 @@ export const RepositoryNotifications: FC<IRepositoryNotifications> = ({
title="Mark Repository as Read"
onClick={markRepoAsRead}
>
<ReadIcon size={14} aria-label="Mark Repository as Read" />
<ReadIcon size={Size.SMALL} aria-label="Mark Repository as Read" />
</button>

<button
Expand All @@ -95,7 +99,7 @@ export const RepositoryNotifications: FC<IRepositoryNotifications> = ({
title={toggleRepositoryNotificationsLabel}
onClick={toggleRepositoryNotifications}
>
<ChevronIcon size={14} />
<ChevronIcon size={Size.SMALL} />
</button>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { type FC, useContext, useMemo } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { AppContext } from '../context/App';
import { Size } from '../types';
import { quitApp } from '../utils/comms';
import {
openGitHubIssues,
Expand Down Expand Up @@ -54,7 +55,7 @@ export const Sidebar: FC = () => {
onClick={() => openGitifyRepository()}
data-testid="gitify-logo"
>
<LogoIcon size="small" aria-label="Open Gitify" />
<LogoIcon size={Size.SMALL} aria-label="Open Gitify" />
</button>

<SidebarButton
Expand Down Expand Up @@ -83,7 +84,7 @@ export const Sidebar: FC = () => {
<SidebarButton
title="Refresh Notifications"
icon={SyncIcon}
size={16}
size={Size.MEDIUM}
loading={status === 'loading'}
disabled={status === 'loading'}
onClick={() => refreshNotifications()}
Expand All @@ -92,7 +93,7 @@ export const Sidebar: FC = () => {
<SidebarButton
title="Settings"
icon={GearIcon}
size={16}
size={Size.MEDIUM}
onClick={() => toggleSettings()}
/>
</>
Expand All @@ -102,7 +103,7 @@ export const Sidebar: FC = () => {
<SidebarButton
title="Quit Gitify"
icon={XCircleIcon}
size={16}
size={Size.MEDIUM}
onClick={() => quitApp()}
/>
)}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/components/buttons/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MarkGithubIcon } from '@primer/octicons-react';
import { fireEvent, render, screen } from '@testing-library/react';
import { shell } from 'electron';
import type { Link } from '../../types';
import { type Link, Size } from '../../types';
import { Button, type IButton } from './Button';

describe('components/buttons/Button.tsx', () => {
Expand All @@ -10,7 +10,7 @@ describe('components/buttons/Button.tsx', () => {
const props: IButton = {
name: 'Button',
label: 'button',
size: 16,
size: Size.MEDIUM,
};

beforeEach(() => {
Expand Down
8 changes: 5 additions & 3 deletions src/components/buttons/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Icon } from '@primer/octicons-react';
import type { FC } from 'react';
import type { Link } from '../../types';
import { type Link, Size } from '../../types';
import { cn } from '../../utils/cn';
import { openExternalLink } from '../../utils/comms';

Expand All @@ -9,7 +9,7 @@ export interface IButton {
label: string;
className?: string;
icon?: Icon;
size?: number;
size?: Size;
url?: Link;
onClick?: () => void;
disabled?: boolean;
Expand All @@ -36,7 +36,9 @@ export const Button: FC<IButton> = (props: IButton) => {
}
}}
>
{props.icon && <props.icon className="mr-1" size={props.size ?? 14} />}
{props.icon && (
<props.icon className="mr-1" size={props.size ?? Size.MEDIUM} />
)}
{props.name}
</button>
);
Expand Down
8 changes: 6 additions & 2 deletions src/components/buttons/PillButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Icon } from '@primer/octicons-react';
import type { FC } from 'react';
import type { IconColor } from '../../types';
import { type IconColor, Size } from '../../types';

export interface IPillButton {
key?: string;
Expand All @@ -17,7 +17,11 @@ export const PillButton: FC<IPillButton> = (props: IPillButton) => {
type="button"
className="flex gap-1 items-center m-0.5 rounded-full bg-gray-100 px-1 text-xxs hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700"
>
<props.icon size={12} className={props.color} aria-label={props.title} />
<props.icon
size={Size.XSMALL}
className={props.color}
aria-label={props.title}
/>
{props.metric}
</button>
);
Expand Down
12 changes: 12 additions & 0 deletions src/components/buttons/SidebarButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MarkGithubIcon } from '@primer/octicons-react';
import { render } from '@testing-library/react';
import { Size } from '../../types';
import { type ISidebarButton, SidebarButton } from './SidebarButton';

describe('components/buttons/SidebarButton.tsx', () => {
Expand All @@ -22,4 +23,15 @@ describe('components/buttons/SidebarButton.tsx', () => {
const tree = render(<SidebarButton {...props} />);
expect(tree).toMatchSnapshot();
});

it('should render - medium', () => {
const props: ISidebarButton = {
title: 'Mock Sidebar Button',
metric: 0,
icon: MarkGithubIcon,
size: Size.MEDIUM,
};
const tree = render(<SidebarButton {...props} />);
expect(tree).toMatchSnapshot();
});
});
6 changes: 3 additions & 3 deletions src/components/buttons/SidebarButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Icon } from '@primer/octicons-react';
import type { FC } from 'react';
import { IconColor } from '../../types';
import { IconColor, Size } from '../../types';
import { cn } from '../../utils/cn';

export interface ISidebarButton {
title: string;
metric?: number;
icon: Icon;
onClick?: () => void;
size?: number;
size?: Size;
loading?: boolean;
disabled?: boolean;
}
Expand All @@ -31,7 +31,7 @@ export const SidebarButton: FC<ISidebarButton> = (props: ISidebarButton) => {
title={props.title}
disabled={props.disabled}
>
<props.icon size={props.size ?? 12} aria-label={props.title} />
<props.icon size={props.size ?? Size.XSMALL} aria-label={props.title} />
{hasMetric && props.metric}
</button>
);
Expand Down
Loading