Skip to content

Commit 9bbdde7

Browse files
committed
Add search icon to Explore More Content section in podcast details
1 parent db7a669 commit 9bbdde7

File tree

3 files changed

+119
-5
lines changed

3 files changed

+119
-5
lines changed

src/pages/podcasts/details.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,81 @@ html[data-theme="light"] {
691691
animation: detailsFadeIn 0.8s ease-out 0.6s both;
692692
}
693693

694+
.section-title-container {
695+
display: flex;
696+
justify-content: space-between;
697+
align-items: center;
698+
margin-bottom: 32px;
699+
}
700+
701+
.section-title-container .section-title {
702+
margin-bottom: 0;
703+
text-align: left;
704+
justify-content: flex-start;
705+
}
706+
707+
.search-toggle-button {
708+
background: var(--details-bg-card);
709+
border: 1px solid var(--details-border);
710+
border-radius: 12px;
711+
padding: 12px;
712+
font-size: 18px;
713+
cursor: pointer;
714+
transition: all 0.3s ease;
715+
color: var(--details-text-primary);
716+
}
717+
718+
.search-toggle-button:hover {
719+
background: var(--details-bg-card-hover);
720+
border-color: var(--details-border-hover);
721+
transform: scale(1.05);
722+
}
723+
724+
.search-bar {
725+
display: flex;
726+
gap: 12px;
727+
margin-bottom: 24px;
728+
animation: detailsFadeIn 0.3s ease-out;
729+
}
730+
731+
.search-bar input {
732+
flex: 1;
733+
padding: 12px 16px;
734+
background: var(--details-bg-card);
735+
border: 1px solid var(--details-border);
736+
border-radius: 12px;
737+
color: var(--details-text-primary);
738+
font-size: 16px;
739+
backdrop-filter: blur(10px);
740+
}
741+
742+
.search-bar input:focus {
743+
outline: none;
744+
border-color: var(--details-accent-primary);
745+
box-shadow: 0 0 0 2px var(--details-glow);
746+
}
747+
748+
.search-bar button {
749+
padding: 12px 20px;
750+
background: linear-gradient(
751+
135deg,
752+
var(--details-accent-primary) 0%,
753+
var(--details-accent-secondary) 100%
754+
);
755+
border: none;
756+
border-radius: 12px;
757+
color: white;
758+
font-size: 16px;
759+
font-weight: 600;
760+
cursor: pointer;
761+
transition: all 0.3s ease;
762+
}
763+
764+
.search-bar button:hover {
765+
transform: translateY(-2px);
766+
box-shadow: 0 8px 20px var(--details-shadow);
767+
}
768+
694769
.suggestions-content {
695770
display: grid;
696771
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));

src/pages/podcasts/details.tsx

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ export default function PodcastDetails(): ReactElement {
9999
}
100100
return [];
101101
});
102+
const [showSearch, setShowSearch] = useState(false);
103+
const [searchTerm, setSearchTerm] = useState("");
102104
const isFavorited = podcast ? favorites.includes(podcast.id) : false;
103105
const toggleFavorite = () => {
104106
if (!podcast) return;
@@ -354,10 +356,39 @@ export default function PodcastDetails(): ReactElement {
354356

355357
{/* Related Content Suggestions */}
356358
<div className="suggestions-section">
357-
<h2 className="section-title">
358-
<span className="title-icon">🚀</span>
359-
Explore More Content
360-
</h2>
359+
<div className="section-title-container">
360+
<h2 className="section-title">
361+
<span className="title-icon">🚀</span>
362+
Explore More Content
363+
</h2>
364+
<button
365+
className="search-toggle-button"
366+
onClick={() => setShowSearch(!showSearch)}
367+
title="Search podcasts"
368+
>
369+
🔍
370+
</button>
371+
</div>
372+
{showSearch && (
373+
<div className="search-bar">
374+
<input
375+
type="text"
376+
placeholder="Search podcasts..."
377+
value={searchTerm}
378+
onChange={(e) => setSearchTerm(e.target.value)}
379+
onKeyDown={(e) => {
380+
if (e.key === "Enter") {
381+
history.push("/podcasts", { searchTerm });
382+
}
383+
}}
384+
/>
385+
<button
386+
onClick={() => history.push("/podcasts", { searchTerm })}
387+
>
388+
Search
389+
</button>
390+
</div>
391+
)}
361392
<div className="suggestions-content">
362393
<div className="suggestion-card primary">
363394
<div className="suggestion-icon">📻</div>

src/pages/podcasts/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState, useEffect } from "react";
22
import Layout from "@theme/Layout";
33
import type { ReactElement } from "react";
4-
import { useHistory } from "@docusaurus/router";
4+
import { useHistory, useLocation } from "@docusaurus/router";
55
import "./index.css";
66

77
interface PodcastData {
@@ -68,6 +68,7 @@ const SpotifyTitle: React.FC<{
6868

6969
export default function Podcasts(): ReactElement {
7070
const history = useHistory();
71+
const location = useLocation();
7172
const [currentPage, setCurrentPage] = useState(1);
7273
const [searchTerm, setSearchTerm] = useState("");
7374
const [selectedFilter, setSelectedFilter] = useState<
@@ -109,6 +110,13 @@ export default function Podcasts(): ReactElement {
109110
};
110111
}, []);
111112

113+
useEffect(() => {
114+
const state = location.state as { searchTerm?: string };
115+
if (state && state.searchTerm) {
116+
setSearchTerm(state.searchTerm);
117+
}
118+
}, [location.state]);
119+
112120
const filteredPodcasts = podcasts.filter((podcast) => {
113121
const matchesFilter =
114122
selectedFilter === "all" || podcast.type === selectedFilter;

0 commit comments

Comments
 (0)