From 8bd3ba39eea6aaa13b43a782b50d337f62975daf Mon Sep 17 00:00:00 2001 From: TomDijkema Date: Wed, 8 May 2024 16:42:03 +0200 Subject: [PATCH 1/6] Make the homepage, header and footer suitable for mobile devices Makes the homepage, header and footer suitable for mobile devices. Does this using bootstrap and custom made css classes that are invoked into the existing components. --- src/App.css | 120 +++++++++++-- src/app/Utilities.ts | 12 +- src/components/general/buttons/Button.tsx | 4 +- .../general/buttons/buttons.module.scss | 6 +- src/components/general/footer/Footer.tsx | 42 ++++- src/components/general/header/Header.tsx | 12 +- .../general/header/header.module.scss | 9 + src/components/home/Home.tsx | 164 +++++++++++------- .../home/components/HomeCategory.tsx | 19 +- src/components/home/components/SearchBar.tsx | 14 +- src/components/home/home.module.scss | 16 +- 11 files changed, 307 insertions(+), 111 deletions(-) diff --git a/src/App.css b/src/App.css index 25b4980..7be2674 100644 --- a/src/App.css +++ b/src/App.css @@ -21,7 +21,13 @@ /* Global styles */ html { height: 100vh; - font-size: 0.85vw; + font-size: 1.9vmax; +} + +@media only screen and (min-width: 768px) { + html { + font-size: 0.85vmax + } } body { @@ -43,7 +49,7 @@ code { #root { height: 100%; width: 100%; - overflow-y: auto; + overflow-y: hidden; overflow-x: hidden; } @@ -66,32 +72,54 @@ p { } /* Font sizes, default is 16px */ -.fs-title { - font-size: 3rem !important; +.fs-5 { + font-size: 0.75rem !important; } -.fs-subTitle { - font-size: 2rem !important; +.fs-4 { + font-size: 0.875rem !important; } -.fs-1 { - font-size: 2.5rem !important; +.fs-3 { + font-size: 1.125rem !important; } .fs-2 { font-size: 1.5rem !important; } -.fs-3 { - font-size: 1.125rem !important; -} - -.fs-4 { - font-size: 0.875rem !important; +.fs-1 { + font-size: 2.5rem !important; } -.fs-5 { - font-size: 0.75rem !important; +@media only screen and (min-width: 768px) { + .fs-lg-5 { + font-size: 0.75rem !important; + } + + .fs-lg-4 { + font-size: 0.875rem !important; + } + + .fs-lg-3 { + font-size: 1.125rem !important; + } + + .fs-lg-2 { + font-size: 1.5rem !important; + } + + .fs-lg-1 { + font-size: 2.5rem !important; + } + + .fs-title { + font-size: 3rem !important; + } + + .fs-subTitle { + font-size: 2rem !important; + } } /* Text color */ @@ -214,6 +242,12 @@ p { overflow-y: hidden; } +@media only screen and (max-width: 768px) { + .overflow-y-lg-scroll { + overflow-y: scroll; + } +} + /* Z-index */ .z-0 { z-index: 0; @@ -227,6 +261,60 @@ p { z-index: 2; } +/* Width and Height */ +@media only screen and (max-width: 768px) { + .w-100 { + width: 100% !important; + } + + .w-50 { + width: 50% !important; + } + + .h-100 { + height: 100% !important; + } + + .h-50 { + height: 50% !important; + } + + .h-auto { + height: auto !important; + } +} + +@media only screen and (min-width: 768px) { + .w-lg-25 { + width: 25% !important; + } + + .h-lg-100 { + height: 100% !important; + } + + .h-lg-50 { + height: 50% !important; + } + + .h-lg-auto { + height: auto !important; + } +} + +/* Position */ +@media only screen and (max-width: 768px) { + .position-absolute { + position: absolute !important; + } +} + +@media only screen and (min-width: 768px) { + .position-lg-static { + position: static !important; + } +} + /* Transition */ .tr-smooth { transition: 0.3s; diff --git a/src/app/Utilities.ts b/src/app/Utilities.ts index b36c234..ea7ea56 100644 --- a/src/app/Utilities.ts +++ b/src/app/Utilities.ts @@ -1,3 +1,7 @@ +/* Import Dependencies */ +import { startCase } from "lodash"; + + /** Function to capitalize the first character of a string */ const Capitalize = (string: string) => { if (string) { @@ -8,11 +12,11 @@ const Capitalize = (string: string) => { } /** Function to replace capitals in a string with spaces to make a readable string */ -const MakeReadableString = (string: string) => { - const splitArray: string[] = string.split(/(?=[A-Z])/); +const MakeReadableString = (string: string) => { + const splitArray: RegExpMatchArray | null = string.match(/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g); - return Capitalize(splitArray.join(' ')); -} + return startCase(splitArray?.join(' ')) ?? startCase(string.split(/(?=[A-Z])/).join(' ')); +}; export { diff --git a/src/components/general/buttons/Button.tsx b/src/components/general/buttons/Button.tsx index 69e6a78..46948a0 100644 --- a/src/components/general/buttons/Button.tsx +++ b/src/components/general/buttons/Button.tsx @@ -9,7 +9,7 @@ import styles from './buttons.module.scss'; interface Props { children?: string | JSX.Element, type: 'button' | 'submit', - variant: 'primary' | 'secondary' | 'blank', + variant: 'primary' | 'secondary' | 'tertiary' | 'blank', className?: string, OnClick?: Function }; @@ -36,7 +36,7 @@ const Button = (props: Props) => { className={`${styles.button} ${styles[variant]} ${buttonClass} fs-4 fw-bold b-none br-round`} onClick={() => OnClick?.()} > - {children} + {children ?? ''} ); }; diff --git a/src/components/general/buttons/buttons.module.scss b/src/components/general/buttons/buttons.module.scss index 958c0f4..19c4e32 100644 --- a/src/components/general/buttons/buttons.module.scss +++ b/src/components/general/buttons/buttons.module.scss @@ -2,7 +2,6 @@ .button { background-color: transparent; transition: 0.3s; - color: inherit; } .button:hover { @@ -19,4 +18,9 @@ .secondary { background-color: var(--secondary); color: white; +} + +.tertiary { + background-color: var(--tertiary); + color: white; } \ No newline at end of file diff --git a/src/components/general/footer/Footer.tsx b/src/components/general/footer/Footer.tsx index 83dd9be..d605c49 100644 --- a/src/components/general/footer/Footer.tsx +++ b/src/components/general/footer/Footer.tsx @@ -14,9 +14,47 @@ const Footer = () => { return ( - + - + {/* Mobile */} + + + + +

+ TETTRIs Grant Agreement 101081903 +

+ + +

{`CETAF ${currentYear}`}

+ +
+ + + + + Funded by EU logo + + + + +
+

Privacy policy

+

Terms and Conditions

+
+ +
+ +
+ +
+ +
+ {/* Desktop */} + Funded by EU logo { return ( - - + + - + CETAF Logo { -

+

Marketplace Prototype

-

+

The Taxonomic Expertise and Services Marketplace

diff --git a/src/components/general/header/header.module.scss b/src/components/general/header/header.module.scss index e9e6cdc..2de9702 100644 --- a/src/components/general/header/header.module.scss +++ b/src/components/general/header/header.module.scss @@ -1,4 +1,13 @@ /* Custom styling for the Header component */ +@media only screen and (max-width: 768px) { + .header { + position: sticky; + -webkit-box-shadow: 1px 7px 15px -7px rgba(0, 0, 0, 0.75); + -moz-box-shadow: 1px 7px 15px -7px rgba(0, 0, 0, 0.75); + box-shadow: 1px 7px 15px -7px rgba(0, 0, 0, 0.75); + } +} + .CETAFLogo { height: 4rem; } \ No newline at end of file diff --git a/src/components/home/Home.tsx b/src/components/home/Home.tsx index ab662c9..64c1f7e 100644 --- a/src/components/home/Home.tsx +++ b/src/components/home/Home.tsx @@ -21,74 +21,106 @@ const Home = () => { {/* Render Header */}
- {/* Home page Body */} - - - - {/* Big background image with Title and primary Search Bar */} - - - {/* Title */} - - -

A hive for finding and supplying
taxonomic expertise and services

-
- - + {/* Home page body */} +
+ {/* Home page body */} + + + + {/* Big background image with Title and primary search bar */} + + + {/* Title */} + + + {/* Desktop */} +

A hive for finding and supplying
taxonomic expertise and services +

+ {/* Mobile */} +

+ A hive for finding
and supplying
taxonomic
expertise
and services +

- {/* Search Bar */} - - - - - - -
- {/* Search Category representation */} - - -
- - - - - - - - - - - - - - - -
- - - - - +
+ + - {/* Render Footer */} -