Skip to content

Commit 144f34f

Browse files
fix(ui): improve responsive heading in QuickstartFilter
1 parent 6b211f1 commit 144f34f

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

src/components/QuickStartFilter.js

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useEffect, useState} from "react";
1+
import React, {useState} from "react";
22
import quickstarts from "./QuickStartList";
33
import Link from "@docusaurus/Link";
44
import {FaGolang} from "react-icons/fa6";
@@ -31,25 +31,9 @@ const IconWrapper = ({icon, bg}) => (
3131
</div>
3232
);
3333

34-
35-
export function useMediaQuery(query) {
36-
const [matches, setMatches] = useState(false);
37-
38-
useEffect(() => {
39-
const media = window.matchMedia(query);
40-
setMatches(media.matches);
41-
const listener = () => setMatches(media.matches);
42-
media.addEventListener("change", listener);
43-
return () => media.removeEventListener("change", listener);
44-
}, [query]);
45-
46-
return matches;
47-
}
48-
4934
export default function QuickstartFilter({defaultLanguage = null}) {
5035
const {colorMode} = useColorMode();
5136
const isDark = colorMode === "dark";
52-
const isMobile = useMediaQuery("(max-width: 480px)");
5337
// 👇 initialize with defaultLanguage if provided
5438
const [language, setLanguage] = useState(defaultLanguage);
5539
const [server, setServer] = useState(null);
@@ -196,8 +180,16 @@ export default function QuickstartFilter({defaultLanguage = null}) {
196180
// ----- Render -----
197181
return (
198182
<div style={{marginTop: "2rem"}}>
183+
<style>{`
184+
@media (max-width: 480px) {
185+
.responsive-heading {
186+
margin-left: 0.75rem !important;
187+
font-size: 1.2rem !important;
188+
}
189+
}
190+
`}</style>
199191
{/* Language Selection */}
200-
<h2 style={headingStyle}>Choose your language</h2>
192+
<h2 className="responsive-heading" style={headingStyle}>Choose your language</h2>
201193
<div style={stepContainer}>
202194
{languages.map((lang) => (
203195
<button
@@ -237,7 +229,7 @@ export default function QuickstartFilter({defaultLanguage = null}) {
237229
</div>
238230

239231
{/* Server Selection */}
240-
<h2 style={{...headingStyle, marginTop: "2rem"}}>
232+
<h2 className="responsive-heading" style={{...headingStyle, marginTop: "2rem"}}>
241233
Where do you want to run the app server?
242234
</h2>
243235
<div style={serverContainer}>
@@ -279,7 +271,7 @@ export default function QuickstartFilter({defaultLanguage = null}) {
279271
{/* Quickstarts */}
280272
{language && server && (
281273
<>
282-
<h2 style={{...headingStyle, marginTop: "2rem"}}>
274+
<h2 className="responsive-heading" style={{...headingStyle, marginTop: "2rem"}}>
283275
✨ AI Suggested Sample Apps
284276
</h2>
285277
<div style={gridContainer}>

0 commit comments

Comments
 (0)