Skip to content

Commit 3391be0

Browse files
fix(frontend): hide top buttons cy-482
1 parent 4599ff8 commit 3391be0

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

apps/frontend/src/pages/plan-style-overview/plan-style-overview.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ import {
3636
import styles from "./styles.module.css";
3737

3838
const PlanStyleOverview: React.FC = () => {
39+
const RESPONSIVE_BREAKPOINT = 768;
40+
const [isMobile, setIsMobile] = useState<boolean>(false);
41+
useEffect(() => {
42+
const checkMobile = (): void => {
43+
setIsMobile(window.innerWidth <= RESPONSIVE_BREAKPOINT);
44+
};
45+
46+
checkMobile();
47+
window.addEventListener("resize", checkMobile);
48+
49+
return (): void => {
50+
window.removeEventListener("resize", checkMobile);
51+
};
52+
}, []);
3953
const user = useAppSelector((state) => state.auth.user);
4054
const currentPlan = useAppSelector(({ plan }) => plan.plan);
4155
const isAuthenticated = Boolean(user);
@@ -152,17 +166,25 @@ const PlanStyleOverview: React.FC = () => {
152166
}
153167

154168
return (
155-
<div className={getClassNames("grid-pattern", styles["page-container"])}>
169+
<div
170+
className={getClassNames(
171+
"grid-pattern",
172+
styles["page-container"],
173+
isMobile && styles["mobile-padding-top"],
174+
)}
175+
>
156176
<AppHeader />
157-
<div className={styles["header-section"]}>
158-
<PlanStyleCategory
159-
actionButtonDisabled={isCalendarDownloading}
160-
actionButtonLabel="Calendar File"
161-
onActionButtonClick={handleOpenCalendarModal}
162-
onSelect={handleCategorySelect}
163-
selectedCategory={selectedCategory}
164-
/>
165-
</div>
177+
{!isMobile && (
178+
<div className={styles["header-section"]}>
179+
<PlanStyleCategory
180+
actionButtonDisabled={isCalendarDownloading}
181+
actionButtonLabel="Calendar File"
182+
onActionButtonClick={handleOpenCalendarModal}
183+
onSelect={handleCategorySelect}
184+
selectedCategory={selectedCategory}
185+
/>
186+
</div>
187+
)}
166188
<div className="flow-loose-xl">
167189
<div className={getClassNames(styles["container"])}>
168190
<div className={getClassNames("wrapper", styles["plan-content"])}>

apps/frontend/src/pages/plan-style-overview/styles.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
padding-bottom: var(--space-xl);
77
}
88

9+
.mobile-padding-top {
10+
padding-top: 38px;
11+
}
12+
913
.container {
1014
position: relative;
1115
display: flex;

0 commit comments

Comments
 (0)