Skip to content

Commit 8ce4ba3

Browse files
WIP the slider within the "pet detail" page
1 parent a59e750 commit 8ce4ba3

12 files changed

+115
-115
lines changed

src/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import AdoptionGalleryPage from './pages/AdoptionGalleryPage'
66
import PetDetailPage from './pages/PetDetailPage'
77
import CheckoutPage from './pages/CheckoutPage'
88
import ReceiptPage from './pages/ReceiptPage'
9-
import MyAccountPage from './pages/MyAccountPage'
109
import PetReleasePage from './pages/PetReleasePage'
1110

1211
const browserRouter = createBrowserRouter([
@@ -16,8 +15,7 @@ const browserRouter = createBrowserRouter([
1615
{ path: ROUTE_URL.PET_DETAIL, element: <PetDetailPage /> },
1716
{ path: ROUTE_URL.CHECKOUT, element: <CheckoutPage /> },
1817
{ path: ROUTE_URL.RECEIPT, element: <ReceiptPage /> },
19-
{ path: ROUTE_URL.MY_ACCOUNT, element: <MyAccountPage /> },
20-
{ path: ROUTE_URL.PET_RELEASE, element: <PetReleasePage/> }
18+
{ path: ROUTE_URL.PET_RELEASE, element: <PetReleasePage /> }
2119
])
2220

2321
const App: React.FC = () => {

src/components/AccountDropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const AccountDropdown: React.FC = () => {
3232
}
3333

3434
return (
35-
<div ref={m_dropdownRef} className='relative cursor-pointer'>
35+
<div ref={m_dropdownRef} className='relative cursor-pointer hidden lg:block'>
3636

3737
{/* --- HEADER BUTTON --- */}
3838
<div onClick={() => setIsOpen(isOpen => !isOpen)} className='flex justify-start items-center'>
3939
<img className='w-8 h-8 mr-margin-xs' src={account_svg} alt="" />
4040
<button className='mr-text flex'>
41-
<span className='mr-text-xxs text-xl'>{
41+
<span className='mr-text-xxs text-lg'>{
4242
m_authCtx?.firebaseUser?.displayName ?
43-
"Hi, " + m_authCtx.firebaseUser.displayName : "User"
43+
"Hi, " + m_authCtx.firebaseUser.displayName.split(' ')[0] : "User"
4444
}</span>
4545
</button>
4646
<img className='rotate-90 w-7 h-7' src={arrow_right_svg} alt="" />

src/components/MorePetsCard.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
import React from 'react'
2-
import { PetApiData } from '../others/Globals'
2+
import { PET_API_TYPE, PetApiData } from '../others/Globals'
33
import heart_svg from '../assets/SVG/heart.svg'
4+
import { useNavigate } from 'react-router-dom'
45

56
const MorePetsCard: React.FC<{ petApiData: PetApiData }> = ({ petApiData }) => {
7+
const m_navTo = useNavigate()
8+
9+
const cardClickHandler = () => {
10+
const petType = petApiData.apiType === PET_API_TYPE.DOG ? "dog" : "cat"
11+
const destURL = `/pet_detail?pet_type=${petType}&pet_id=${petApiData.id}&breed_id=${petApiData.breedData?.breed_id}`
12+
m_navTo(destURL)
13+
}
14+
615
return (
7-
<div className='
16+
<div onClick={cardClickHandler} className='
817
w-full min-h-72 bg-white outline outline-1 outline-gray-300 rounded-lg shadow-lg
9-
cursor-pointer relative
18+
cursor-pointer relative
1019
'>
11-
<div style={{
12-
backgroundImage: `url(${petApiData.imgURL})`
13-
}} className='absolute top-0 bottom-0 left-0 right-0 rounded-lg bg-cover'></div>
20+
<div
21+
style={{ backgroundImage: `url(${petApiData.imgURL})` }}
22+
className='absolute top-0 bottom-0 left-0 right-0 rounded-lg bg-cover
23+
'></div>
1424
<div className='w-full flex justify-end items-start'>
15-
<button style={{
16-
backgroundColor: "rgba(255, 255, 255, 0.8)"
17-
}} className='w-14 h-14 mr-margin-xs mt-margin-xs rounded-lg z-10'>
25+
<button
26+
style={{ backgroundColor: "rgba(255, 255, 255, 0.8)" }}
27+
className='w-14 h-14 mr-margin-xs mt-margin-xs rounded-lg z-10
28+
'>
1829
<img className='w-full h-full px-3 py-3' src={heart_svg} alt="" />
1930
</button>
2031
</div>

src/components/Navbar.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import AccountDropdown from './AccountDropdown'
77

88
interface NavbarProps {
99
useSticky?: boolean
10-
scrollFadeMax?: number
10+
scrollFadeMax?: number
1111
}
1212

1313
const Navbar: React.FC<NavbarProps> = props => {
@@ -49,7 +49,7 @@ const Navbar: React.FC<NavbarProps> = props => {
4949
</Link>
5050

5151
{/* --- SMALL NAVBAR | HIDES WHEN SCREEN EXPANDS ---- */}
52-
<nav className='flex justify-between md:hidden'>
52+
<nav className='flex justify-between lg:hidden'>
5353
<button className='h-full flex flex-col justify-center items-center gap-2 p-2'>
5454
<div className='bg-background-950 h-[2px] w-8'></div>
5555
<div className='bg-background-950 h-[2px] w-8'></div>
@@ -59,19 +59,19 @@ const Navbar: React.FC<NavbarProps> = props => {
5959

6060
{/* --- LARGE NAVBAR | SHOWS WHEN SCREEN EXPANDS ---- */}
6161
<nav className='
62-
hidden md:flex justify-center items-center
63-
gap-11 lg:gap-20
62+
hidden lg:flex justify-center items-center
63+
gap-11 md:gap-16 lg:gap-28
6464
'>
65-
<Link className='hover:text-accent-600 transition-colors' to={ROUTE_URL.GALLERY}>Adoption</Link>
66-
<Link className='hover:text-accent-600 transition-colors' to={ROUTE_URL.ABOUT}>About</Link>
67-
<Link className='hover:text-accent-600 transition-colors' to={ROUTE_URL.CONTACT_US}>Contact Us</Link>
65+
<Link className='hover:text-accent-600 transition-colors' to={ROUTE_URL.HOME}>Home</Link>
66+
<Link className='hover:text-accent-600 transition-colors' to={ROUTE_URL.GALLERY}>Adopt</Link>
67+
<Link className='hover:text-accent-600 transition-colors' to={ROUTE_URL.PET_RELEASE}>Pet Release</Link>
6868
</nav>
6969
{
7070
(authCtx && authCtx.firebaseUser) ?
7171
<AccountDropdown /> :
7272
<Link className='
7373
hidden justify-center items-center bg-primary-500 px-7 h-10 rounded-lg
74-
md:flex hover:bg-primary-600 transition-colors' to={ROUTE_URL.AUTH}
74+
lg:flex hover:bg-primary-600 transition-colors' to={ROUTE_URL.AUTH}
7575
>Login</Link>
7676
}
7777
</header>

src/components/sections/HeroSection.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const HeroSection: React.FC = () => {
1515
'>
1616

1717
{/* ---- VIDEO GRID ---- */}
18-
<video className='w-full h-full object-cover' autoPlay loop={true} src={pet_video_1} />
19-
<video className='w-full h-full object-cover' autoPlay loop={true} src={pet_video_2} />
20-
<video className='w-full h-full object-cover' autoPlay loop={true} src={pet_video_3} />
21-
<video className='w-full h-full object-cover' autoPlay loop={true} src={pet_video_4} />
22-
<video className='w-full h-full object-cover' autoPlay loop={true} src={pet_video_5} />
23-
<video className='w-full h-full object-cover' autoPlay loop={true} src={pet_video_6} />
18+
<video className='w-full h-full object-cover' autoPlay loop src={pet_video_1} />
19+
<video className='w-full h-full object-cover' autoPlay loop src={pet_video_2} />
20+
<video className='w-full h-full object-cover' autoPlay loop src={pet_video_3} />
21+
<video className='w-full h-full object-cover' autoPlay loop src={pet_video_4} />
22+
<video className='w-full h-full object-cover' autoPlay loop src={pet_video_5} />
23+
<video className='w-full h-full object-cover' autoPlay loop src={pet_video_6} />
2424

2525
{/* ----- OPACITY OVERLAY ----- */}
2626
<div className='absolute top-0 bottom-0 left-0 right-0 bg-primary-50 opacity-70'></div>
@@ -36,13 +36,8 @@ const HeroSection: React.FC = () => {
3636
<p className='text-xl mb-6'>Where every animal, big or small, deserves to find a loving forever home. Begin your adoption journey today, and find yourself a furry friend!</p>
3737
<div className='h-14'>
3838
<button className='
39-
bg-primary-500 px-5 h-full rounded-lg mr-3
40-
hover:bg-primary-600 transition-colors
41-
'>Adopt a Pet</button>
42-
<button className='
43-
border-2 border-primary-500 px-5 h-full rounded-lg
44-
hover:bg-primary-600 hover:text-text-950
45-
'>Donate</button>
39+
bg-primary-500 px-5 h-full rounded-lg mr-3 hover:bg-primary-600 transition-colors
40+
'>Adopt a Pet</button>
4641
</div>
4742
</div>
4843
</div>

src/others/Globals.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const ROUTE_URL = {
99
CONTACT_US: "/contact_us",
1010
AUTH: "/auth",
1111
OUR_HISTORY: "/our_history",
12-
MY_ACCOUNT: "/account",
1312
RECEIPT: "/receipt",
1413
PET_RELEASE: "/pet_release"
1514
}

src/pages/AdoptionGalleryPage.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const AdoptionGalleryPage: React.FC = () => {
3636
])
3737

3838
const fetchPetApiData = async (): Promise<void> => {
39-
const allPetData = await Utils.getBatchPetAPIData(10)
39+
const allPetData = await Utils.getBatchPetAPIData(20)
4040
Utils.durstenfeldShuffle(allPetData)
4141
setPetData(allPetData)
4242
setIsLoading(false)
@@ -49,9 +49,8 @@ const AdoptionGalleryPage: React.FC = () => {
4949
return arr.map((_, idx) => {
5050
return (
5151
<div
52-
key={idx}
53-
style={{ height: `${Utils.randInt(16, 23)}rem` }}
54-
className='w-full min-w-80 bg-gray-300 animate-pulse rounded-lg shadow-lg mb-4'>
52+
key={idx} style={{ height: `${Utils.randInt(16, 23)}rem` }}
53+
className='w-full min-w-64 bg-gray-300 animate-pulse rounded-lg shadow-lg mb-4'>
5554
</div>
5655
)
5756
})
@@ -60,30 +59,27 @@ const AdoptionGalleryPage: React.FC = () => {
6059
return (
6160
<main>
6261
<Navbar useSticky={true} />
63-
<section className='flex justify-center items-center py-margin-l px-margin-s'>
62+
<section className='flex justify-center items-center py-margin-xl px-margin-s'>
6463
<div className='flex'>
6564

6665
{/* ---- DROPDOWN CONTAINER ---- */}
6766
<div className='mr-margin-m'>
6867
<Dropdown
69-
label='Gender'
70-
options={m_petTypeDropdown}
68+
label='Gender' options={m_petTypeDropdown}
7169
setOptions={setPetTypeDropdown}
7270
/>
7371
</div>
7472

7573
<div className='mr-margin-m'>
7674
<Dropdown
77-
label='Sizes'
78-
options={m_sizesDropdown}
75+
label='Sizes' options={m_sizesDropdown}
7976
setOptions={setSizesDropdown}
8077
/>
8178
</div>
8279

8380
<div className='mr-margin-m'>
8481
<Dropdown
85-
label='Ages'
86-
options={m_agesDropdown}
82+
label='Ages' options={m_agesDropdown}
8783
setOptions={setAgesDropdown}
8884
/>
8985
</div>
@@ -97,14 +93,18 @@ const AdoptionGalleryPage: React.FC = () => {
9793
/>
9894
</div>
9995
</div>
100-
10196
</section>
10297

103-
<section className='min-h-96 flex justify-center items-center'>
98+
<section className='min-h-96 flex flex-col justify-center items-center'>
10499
<div className='max-w-6xl mx-margin-s columns-2 md:columns-3 2xl:columns-4 my-margin-l'>{
105-
m_isLoading ? getAnimatedCards() :
100+
m_isLoading ?
101+
getAnimatedCards() :
106102
m_petData.map(data => <PetInfoCard key={data.id} petApiData={data} />)
107103
}</div>
104+
<button className='
105+
w-56 h-12 bg-accent-500 my-margin-xl rounded-lg
106+
text-text-950 font-medium hover:bg-accent-600 transition-colors
107+
'>Load more</button>
108108
</section>
109109
<FooterSection />
110110
</main>

src/pages/CheckoutPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const CheckoutInput: React.FC<CheckoutInputFieldProps> = props => {
1313
<input
1414
type={props.inputType} placeholder={props.placeholderText || ""}
1515
className='
16-
w-full h-10 px-4 focus:outline-none
17-
border-gray-300 border-[1px] rounded-lg bg-transparent
18-
' />
16+
w-full h-10 px-4 focus:outline-none
17+
border-gray-300 border-[1px] rounded-lg bg-transparent'
18+
/>
1919
</label>
2020
)
2121
}

src/pages/HomePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import PetReleaseSection from '../components/sections/PetReleaseSection'
1111
const HomePage: React.FC = () => {
1212
return (
1313
<main>
14-
<Navbar scrollFadeMax={300}/>
14+
<Navbar scrollFadeMax={400}/>
1515
<HeroSection />
1616
<AboutUsSection />
1717
<PetStatsSection />

src/pages/MyAccountPage.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/pages/PetDetailPage.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import MorePetsCard from '../components/MorePetsCard'
77

88
import LoadingScreen from '../components/LoadingScreen'
99
import AdditionalDetailCard from '../components/AdditionalDetailCard'
10-
import { LoremIpsum } from 'lorem-ipsum'
1110

1211
import calendar_svg from '../assets/SVG/calendar.svg'
1312
import ruler_svg from '../assets/SVG/ruler.svg'
@@ -47,7 +46,7 @@ const PetDetailPage: React.FC = () => {
4746
setIsLoading(false)
4847
}
4948
fetchRequiredPetApiData()
50-
}, [])
49+
}, [m_searchParams])
5150

5251
interface PetAttribute {
5352
attribute: string
@@ -92,9 +91,23 @@ const PetDetailPage: React.FC = () => {
9291
<section className='min-h-[50rem] text-center flex flex-col justify-start items-center'>
9392

9493
{/* ---- BANNER IMAGE ---- */}
95-
<div style={{
96-
backgroundImage: `url(${m_petApiData.imgURL})`
97-
}} className='w-full h-96 mb-margin-xl'></div>
94+
<div className='w-full h-96 mx-margin-l mb-margin-l relative'>
95+
<div className='absolute top-0 left-0 right-0 bottom-0 flex'>
96+
<div
97+
style={{ backgroundImage: `url(${m_petApiData.imgURL})` }}
98+
className='w-[10%] h-96 mb-margin-xl
99+
'></div>
100+
<div
101+
style={{ backgroundImage: `url(${m_petApiData.imgURL})` }}
102+
className='w-[10%] h-96 mb-margin-xl
103+
'></div>
104+
<div
105+
style={{ backgroundImage: `url(${m_petApiData.imgURL})` }}
106+
className='w-[10%] h-96 mb-margin-xl
107+
'></div>
108+
</div>
109+
</div>
110+
98111

99112
{/* --- BODY (constrained width) --- */}
100113
<div className='max-w-7xl mx-margin-l'>
@@ -103,7 +116,7 @@ const PetDetailPage: React.FC = () => {
103116
<div className='flex flex-col md:flex-row'>
104117

105118
{/* --- DESCRIPTION CONTAINER --- */}
106-
<div className='text-center flex-col items-start min-w-96 mb-margin-xl mr-margin-l'>
119+
<div className='text-center flex-col items-start min-w-[30rem] mb-margin-xl mr-margin-l'>
107120

108121
{/* ---- DESC HEADER ---- */}
109122
<h1 className='font-bold text-3xl text-left mb-margin-xxs'>{m_petApiData.breedData?.breed.toUpperCase()}</h1>
@@ -113,15 +126,14 @@ const PetDetailPage: React.FC = () => {
113126
m_petApiData.apiType === PET_API_TYPE.DOG ?
114127
`${m_petApiData.breedData?.breed}'s are bred for ${(m_petApiData.breedData as DogBreedData).bredFor}` :
115128
`${(m_petApiData.breedData as CatBreedData).description}`
116-
}</p>
129+
}</p>
117130

118131
{/* ---- PET ATTRIBUTES/INFO ----- */}
119132
<div className=''>{
120133
m_petApiData.breedData?.temperaments.map((temperament, idx) => {
121134
return (
122135
<div key={idx} className='flex justify-start items-center mb-margin-m'>
123136
<img className='w-7 mr-margin-s' src={SVGs[Utils.randInt(0, SVGs.length - 1)]} alt="" />
124-
{/* <span className='mr-margin-xs'><strong>•</strong></span> */}
125137
<span className='text-left font-medium text-text-200'>{temperament}</span>
126138
</div>
127139
)

0 commit comments

Comments
 (0)