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

+1-1
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

+9-10
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

+16-13
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

+1-1
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

+3-6
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

+1-1
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

+2-1
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

+1-1
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

+5-3
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

+2-2
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;

src/components/input/contact-form.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import {
1717
import {
1818
AlertType,
1919
type InputValidationOptions,
20-
type PropsWithClassName,
2120
TooltipPosition,
22-
} from '../../types/types';
21+
} from '../../types/components';
22+
import type { PropsWithClassName } from '../../types/components';
2323
import { GhostAlert } from '../ghost-alert';
2424
import { Checkbox } from './checkbox';
2525
import { MultilineTextInput } from './multiline-text-input';

src/components/input/ghost-button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { getClassNameProps } from '../../common/utils';
7-
import type { Button } from '../../types/types';
7+
import type { Button } from '../../types/components';
88
import { BaseButton } from './base-button';
99

1010
export function GhostButton({

src/components/input/multiline-text-input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
Input,
1010
InputElementRenderFunction,
1111
InputOptions,
12-
} from '../../types/types';
12+
} from '../../types/components';
1313
import { BaseInput } from './base-input';
1414

1515
interface Props extends Input {

src/components/input/solid-button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { getClassNameProps } from '../../common/utils';
7-
import type { Button } from '../../types/types';
7+
import type { Button } from '../../types/components';
88
import { Card } from '../card';
99
import { BaseButton } from './base-button';
1010

src/components/input/text-input.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ 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+
// Types
16+
17+
interface Props extends Input {
1618
inputOptions?: {
1719
type?: string;
1820
placeholder?: string;
1921
} & InputOptions;
2022
}
2123

22-
const defaultInputOptions = {
23-
type: 'text',
24-
};
25-
2624
export function TextInput({
2725
inputClassName,
2826
name,
29-
inputOptions = defaultInputOptions,
27+
inputOptions = {
28+
type: 'text',
29+
},
3030
errors,
3131
...remainingProps
3232
}: Props) {

src/components/layout/document-page-layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { MotionConfig } from 'framer-motion';
77
import { type PropsWithChildren, StrictMode } from 'react';
88
import { SPRING_TRANSITION_PROPS } from '../../common/constants';
99
import { getClassNameProps } from '../../common/utils';
10-
import type { PropsWithClassName } from '../../types/types';
10+
import type { PropsWithClassName } from '../../types/components';
1111
import { PageCounter } from '../page-counter';
1212
import { ResumeHeader } from './resume-header';
1313

src/components/layout/footer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { faGithub, faLinkedin } from '@fortawesome/free-brands-svg-icons';
77
import { getSiteMetadata } from '../../common/config-manager';
88
import { PRIVACY_POLICY_PATH } from '../../common/constants';
9-
import { TooltipPosition } from '../../types/types';
9+
import { TooltipPosition } from '../../types/components';
1010
import { Divider } from '../divider';
1111
import { GhostButtonLink } from '../links/ghost-button-link';
1212

src/components/layout/header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { motion } from 'framer-motion';
77
import { getSiteMetadata } from '../../common/config-manager';
88
import { TITLE_LAYOUT_ID } from '../../common/constants';
99
import { getClassNameProps, isDefined } from '../../common/utils';
10-
import type { PageSection } from '../../types/types';
10+
import type { PageSection } from '../../types/components';
1111
import { Divider } from '../divider';
1212
import { Tabs } from '../tabs';
1313
import { Heading } from '../text/heading';

src/components/layout/page-layout.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { MotionConfig } from 'framer-motion';
77
import { type PropsWithChildren, StrictMode, lazy } from 'react';
88
import { SPRING_TRANSITION_PROPS } from '../../common/constants';
99
import { getClassNameProps } from '../../common/utils';
10-
import type { PageSection, PropsWithClassName } from '../../types/types';
10+
import type { PageSection } from '../../types/components';
11+
import type { PropsWithClassName } from '../../types/components';
1112
import { Footer } from './footer';
1213
import { Header } from './header';
1314

src/components/layout/particles-background.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useReducedMotion } from 'framer-motion';
1111
import { memo, useEffect, useState } from 'react';
1212
import { getTheme } from '../../common/config-manager';
1313
import { getClassNameProps } from '../../common/utils';
14-
import { ThemeType } from '../../types/types';
14+
import { ThemeType } from '../../types/other';
1515

1616
// Constants
1717

src/components/layout/resume-header.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
import { getSiteMetadata } from '../../common/config-manager';
1313
import { CONTACT_PATH } from '../../common/constants';
1414
import { getAbsoluteUrl, removeProtocol } from '../../common/utils';
15-
import { type CityAndStateString, TooltipPosition } from '../../types/types';
15+
import { TooltipPosition } from '../../types/components';
16+
import type { CityAndStateString } from '../../types/strings';
1617
import { GhostButton } from '../input/ghost-button';
1718
import { GhostButtonLink } from '../links/ghost-button-link';
1819
import { Heading } from '../text/heading';

src/components/layout/section-header.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import type { PropsWithChildren } from 'react';
77
import { getClassNameProps } from '../../common/utils';
88
import {
99
type ButtonElementRenderFunction,
10-
type PropsWithClassName,
1110
TooltipPosition,
12-
} from '../../types/types';
11+
} from '../../types/components';
12+
import type { PropsWithClassName } from '../../types/components';
1313
import { SectionHeading } from '../text/section-heading';
1414

1515
interface Props extends PropsWithClassName, PropsWithChildren {

src/components/layout/section.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
import { type ForwardedRef, type PropsWithChildren, forwardRef } from 'react';
77
import { getClassNameProps, toKebabCase } from '../../common/utils';
8-
import type {
9-
ButtonElementRenderFunction,
10-
PropsWithClassName,
11-
} from '../../types/types';
8+
import type { ButtonElementRenderFunction } from '../../types/components';
9+
import type { PropsWithClassName } from '../../types/components';
1210
import { Divider } from '../divider';
1311
import { SectionHeader } from './section-header';
1412

src/components/links/ghost-button-link.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
------------------------------------------------
44
*/
55

6-
import type { Button, Link } from '../../types/types';
6+
import type { Button, Link } from '../../types/components';
77
import { GhostButton } from '../input/ghost-button';
88
import { LinkWrapper } from './link-wrapper';
99

src/components/links/inline-link.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55

66
import { getClassNameProps } from '../../common/utils';
7-
import type { Link, PropsWithClassName } from '../../types/types';
7+
import type { Link } from '../../types/components';
8+
import type { PropsWithClassName } from '../../types/components';
89
import { LinkWrapper } from './link-wrapper';
910

1011
interface Props extends PropsWithClassName, Link {

src/components/links/link-wrapper.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import { Link as GatsbyLink } from 'gatsby';
77
import type { PropsWithChildren } from 'react';
88
import { getClassNameProps } from '../../common/utils';
9-
import type { Link, PropsWithClassName } from '../../types/types';
9+
import type { Link } from '../../types/components';
10+
import type { PropsWithClassName } from '../../types/components';
1011

1112
interface Props extends Link, PropsWithClassName, PropsWithChildren {}
1213

src/components/links/solid-button-link.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
----------------------------------------------
44
*/
55

6-
import type { Button, Link } from '../../types/types';
6+
import type { Button, Link } from '../../types/components';
77
import { SolidButton } from '../input/solid-button';
88
import { LinkWrapper } from './link-wrapper';
99

src/components/loader.tsx

+1-1
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 Loader({ className }: PropsWithClassName) {
1010
const classNameProps = getClassNameProps('size-full', className);

src/components/page-counter.tsx

+1-1
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
// Types
1010

src/components/pill.tsx

+1-1
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
interface Props extends PropsWithClassName {
1010
text: string;

src/components/project-card-gallery.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
import { getClassNameProps } from '../common/utils';
77
import { ProjectCard } from '../components/project-card';
8-
import type { Project, PropsWithClassName } from '../types/types';
8+
import type { PropsWithClassName } from '../types/components';
9+
import type { Project } from '../types/projects';
910

1011
interface Props extends PropsWithClassName {
1112
projects: Project[];

0 commit comments

Comments
 (0)