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

Mobile optimizations to homepage #37

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const HomePage = async () => {
</FadeInView>
</div>
</div>
<div className="col-span-1">
<div className="col-span-1 p-4 sm:p-0">
<FadeInView threshold={0.35} durationMS={1000}>
<img
alt="homepage photography image tiles"
Expand Down Expand Up @@ -171,7 +171,7 @@ const HomePage = async () => {
</h5>
</FadeInView>
<FadeInView once>
<PhotographyCustomersGrid className="my-4" />
<PhotographyCustomersGrid className="my-4 px-4 sm:px-0" />
</FadeInView>
<FadeInView once>
<p className="caption text-center">
Expand Down
15 changes: 15 additions & 0 deletions src/utils/enum.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
/**
* Converts an enum value to its corresponding string key.
*
* @param {E} enumValue - the enum value to convert
* @param {Record<string, unknown>} enumType - the enum type to search for the value in
* @return {string | undefined} the string key corresponding to the enum value, or undefined if not found
*/
export function enumToString<E>(
enumValue: E,
enumType: Record<string, unknown>,
): string | undefined {
const keys = Object.keys(enumType);
console.log(`keys: ${keys}`);
const key = keys.find(
(k) => enumType[k as keyof typeof enumType] === enumValue,
);
return key;
}

/**
* Finds the key in the enumType and returns the corresponding value.
*
* @param {unknown} key - The key to search for in the enumType.
* @param {Record<string, unknown>} enumType - The enumType to search within.
* @return {E | undefined} The corresponding value of the key if found, otherwise undefined.
*/
export function stringToEnum<E>(
key: unknown,
enumType: Record<string, unknown>,
Expand Down