Skip to content

Commit bb53252

Browse files
committed
Make selected functions and types private. Split types.ts into multiple files. Add documentation for types
1 parent c034d38 commit bb53252

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+791
-647
lines changed

gatsby-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
SOCIAL_IMAGES_PATH,
1818
} from './src/common/constants';
1919
import { getAbsoluteUrl } from './src/common/utils';
20-
import { SocialImageType, ThemeType } from './src/types/types';
20+
import { SocialImageType, ThemeType } from './src/types/other';
2121
import tailwindConfig from './tailwind.config';
2222

2323
const SITE_METADATA = getSiteMetadata();

gatsby-node.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ import {
2323
deletePage,
2424
setGatsbyNodeHelpers,
2525
} from './src/node/utils';
26-
import {
27-
type AbsolutePathString,
28-
type EmptyObject,
29-
EntryPage,
30-
type IndexPageContext,
31-
type PageMetadata,
32-
type Project,
33-
type ProjectPageContext,
34-
type ResumePageContext,
35-
} from './src/types/types';
26+
import { EntryPage, type PageMetadata } from './src/types/other';
27+
import type {
28+
IndexPageContext,
29+
ProjectPageContext,
30+
ResumePageContext,
31+
} from './src/types/page-context';
32+
import type { Project } from './src/types/projects';
33+
import type { AbsolutePathString } from './src/types/strings';
34+
import type { EmptyObject } from './src/types/utils';
3635

3736
// Constants
3837

src/common/config-manager.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@ import { employmentRolesConfig } from '../config/roles/employment';
1414
import { volunteeringRolesConfig } from '../config/roles/volunteering';
1515
import { socialImagesGenerationConfig } from '../config/social-images-generation';
1616
import { themesConfig } from '../config/themes';
17+
import type {
18+
EntryPage,
19+
EntryVisibility,
20+
PageMetadata,
21+
SocialImageType,
22+
SocialImagesGenerationConfig,
23+
Theme,
24+
ThemesConfig,
25+
} from '../types/other';
1726
import {
18-
type BgColorString,
19-
type EmploymentRole,
20-
type EntryPage,
21-
type EntryVisibility,
2227
type OtherProject,
23-
type PageMetadata,
2428
ProjectCategory,
2529
type ProjectConfig,
26-
type Role,
27-
type SentenceString,
28-
type SocialImageType,
29-
type SocialImagesGenerationConfig,
30-
type Theme,
31-
type ThemesConfig,
32-
type UrlString,
33-
} from '../types/types';
30+
} from '../types/projects';
31+
import type { EmploymentRole, Role } from '../types/roles';
32+
import type {
33+
BgColorString,
34+
SentenceString,
35+
UrlString,
36+
} from '../types/strings';
3437
import { arrayToObject, isDefined } from './utils';
3538

3639
// Types

src/common/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--------------------------------------------------
44
*/
55

6-
import type { AbsolutePathString, WorkingPathString } from '../types/types';
6+
import type { AbsolutePathString, WorkingPathString } from '../types/strings';
77

88
// Constants
99

src/common/utils.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
*/
55

66
import { panic } from '../node/logger';
7-
import type {
8-
PropsWithClassName,
9-
SentenceString,
10-
UrlString,
11-
} from '../types/types';
7+
import type { PropsWithClassName } from '../types/components';
8+
import type { SentenceString, UrlString } from '../types/strings';
129
import { getSiteMetadata } from './config-manager';
1310

1411
// Types
@@ -101,7 +98,7 @@ const STATUS_CODE_MESSAGE_MAP = {
10198

10299
// Check if the window object exists
103100
// This will return false if the method is called from a server-side environment
104-
export function doesWindowExist(): boolean {
101+
function doesWindowExist(): boolean {
105102
return typeof window !== 'undefined';
106103
}
107104

src/components/divider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { getClassNameProps } from '../common/utils';
7-
import type { PropsWithClassName } from '../types/types';
7+
import type { PropsWithClassName } from '../types/components';
88

99
export function Divider({ className }: PropsWithClassName) {
1010
const classNameProps = getClassNameProps('m-0 h-auto divider', className);

src/components/ghost-alert.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
1313
import { AnimatePresence, motion } from 'framer-motion';
1414
import { FADE_IN_ANIMATION_PROPS } from '../common/constants';
1515
import { getClassNameProps } from '../common/utils';
16-
import { AlertType, type PropsWithClassName } from '../types/types';
16+
import { AlertType } from '../types/components';
17+
import type { PropsWithClassName } from '../types/components';
1718

1819
// Types
1920

src/components/input/base-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
88
import { AnimatePresence, motion } from 'framer-motion';
99
import { FADE_IN_ANIMATION_PROPS } from '../../common/constants';
1010
import { getClassNameProps } from '../../common/utils';
11-
import type { Button } from '../../types/types';
11+
import type { Button } from '../../types/components';
1212
import { Tooltip } from '../tooltip';
1313

1414
export function BaseButton({

src/components/input/base-input.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import {
1111
AlertType,
1212
type InputElementRenderFunction,
1313
type InputValidationOptions,
14-
type PropsWithClassName,
15-
type PropsWithLayoutAnimations,
16-
} from '../../types/types';
14+
} from '../../types/components';
15+
import type {
16+
PropsWithClassName,
17+
PropsWithLayoutAnimations,
18+
} from '../../types/components';
1719
import { GhostAlert } from '../ghost-alert';
1820

1921
interface BaseInput extends PropsWithClassName, PropsWithLayoutAnimations {

src/components/input/checkbox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import type {
99
Input,
1010
InputElementRenderFunction,
1111
InputOptions,
12-
} from '../../types/types';
12+
} from '../../types/components';
1313
import { BaseInput } from './base-input';
1414

15-
export interface Props extends Input {
15+
interface Props extends Input {
1616
inputOptions?: {
1717
defaultChecked?: boolean;
1818
} & InputOptions;

0 commit comments

Comments
 (0)