Skip to content

Commit 25e8cb6

Browse files
committed
fix: search-card + home responsive styles
1 parent 0422cec commit 25e8cb6

File tree

4 files changed

+35
-41
lines changed

4 files changed

+35
-41
lines changed

src/views/components/search-bar.tsx

+27-29
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
export default function SearchBar({ source }: { source?: string }) {
22
return (
3-
<>
4-
<form
5-
id="search-form"
6-
hx-post="/search"
7-
hx-target="#search-results"
8-
hx-swap="innerHTML"
9-
hx-indicator="#loading-indicator"
10-
hx-request='\"timeout\":6000'
11-
class="flex w-full max-w-3xl items-center justify-center"
3+
<form
4+
id="search-form"
5+
hx-post="/search"
6+
hx-target="#search-results"
7+
hx-swap="innerHTML"
8+
hx-indicator="#loading-indicator"
9+
hx-request='\"timeout\":6000'
10+
class="flex w-full max-w-3xl items-center justify-center px-2"
11+
>
12+
<label for="song-link" class="sr-only">
13+
Search
14+
</label>
15+
<input
16+
type="text"
17+
id="song-link"
18+
name="link"
19+
class="flex-1 rounded-lg border bg-white p-2.5 text-sm font-normal text-black placeholder:text-gray-400 lg:text-base"
20+
placeholder="https://open.spotify.com/track/7A8MwSsu9efJXP6xvZfRN3?si=d4f1e2eb324c43df"
21+
value={source}
22+
/>
23+
<button
24+
type="submit"
25+
class="ml-2 rounded-lg border border-green-500 bg-green-500 p-2.5 text-sm font-medium text-white focus:outline-none focus:ring-1 focus:ring-white"
1226
>
13-
<label for="song-link" class="sr-only">
14-
Search
15-
</label>
16-
<input
17-
type="text"
18-
id="song-link"
19-
name="link"
20-
class="flex-1 rounded-lg border bg-white p-2.5 text-sm font-normal text-black placeholder:text-gray-400 lg:text-base"
21-
placeholder="https://open.spotify.com/track/7A8MwSsu9efJXP6xvZfRN3?si=d4f1e2eb324c43df"
22-
value={source}
23-
/>
24-
<button
25-
type="submit"
26-
class="ml-2 rounded-lg border border-green-500 bg-green-500 p-2.5 text-sm font-medium text-white focus:outline-none focus:ring-1 focus:ring-white"
27-
>
28-
<i class="fas fa-search p-1 text-black" />
29-
<span class="sr-only">Search</span>
30-
</button>
31-
</form>
32-
</>
27+
<i class="fas fa-search p-1 text-black" />
28+
<span class="sr-only">Search</span>
29+
</button>
30+
</form>
3331
);
3432
}

src/views/components/search-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export default function SearchCard(props: { searchResult: SearchResult }) {
99
data-id={props.searchResult.id}
1010
class="m-4 flex max-w-2xl flex-wrap items-start justify-center rounded-lg border border-white md:p-4"
1111
>
12-
<div class="w-full m-4">
12+
<div class="w-full m-4 md:w-44">
1313
<img
14-
class="mx-auto w-28 lg:w-48"
14+
class="mx-auto w-28 md:w-44"
1515
src={props.searchResult.image}
1616
alt={props.searchResult.title}
1717
/>

src/views/css/index.css

-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ html {
1616
animation: loading 2s linear infinite;
1717
}
1818

19-
.min-screen-4 {
20-
min-height: calc(100vh - 4rem);
21-
}
22-
2319
@keyframes loading {
2420
0% {
2521
left: -100%;

src/views/pages/home.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ export default function Home({
1010
children?: JSX.Element;
1111
}) {
1212
return (
13-
<div class="flex flex-col">
13+
<div class="flex flex-col gap-2 h-screen p-2">
1414
<LoadingIndicator />
15-
<main class="flex flex-1 flex-col items-center justify-start p-2 min-screen-4">
16-
<div class="my-7 text-center sm:my-16">
15+
<main class="flex flex-1 flex-col items-center justify-start">
16+
<div class="flex flex-col gap-4 my-8 text-center sm:my-12">
1717
<h1 class="text-4xl uppercase md:text-5xl lg:text-6xl">I don't have Spotify</h1>
18-
<h2 class="mt-6 text-sm lg:text-lg">
18+
<h2 class="text-sm lg:text-lg">
1919
Paste a Spotify link and listen on other platforms.
2020
</h2>
2121
</div>
22-
<SearchBar source={source} />
23-
<div class="my-4">
22+
<div class="my-4 flex flex-col gap-4">
23+
<SearchBar source={source} />
2424
<div id="search-results">{children}</div>
2525
</div>
2626
</main>

0 commit comments

Comments
 (0)