Skip to content

Commit

Permalink
Adjust card style on smaller screens
Browse files Browse the repository at this point in the history
  • Loading branch information
IanRamosC committed Nov 4, 2024
1 parent 2b9479c commit 69f25b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useEvaluationRecommendations from '../../data/evaluation-recommendations/
import useAnalytics from '../../hooks/use-analytics';
import { JetpackModuleToProductCard } from '../product-cards-section/all';
import styles from './style.module.scss';
import type { FC } from 'react';
import type { FC, RefObject } from 'react';

const EvaluationRecommendations: FC = () => {
const containerRef = useRef( null );
Expand All @@ -28,7 +28,7 @@ const EvaluationRecommendations: FC = () => {
}, [ containerRef ] );

const handleSlide = (
cardContainerRef: React.RefObject< HTMLUListElement >,
cardContainerRef: RefObject< HTMLUListElement >,
direction: number,
gap: number = 24
) => {
Expand Down Expand Up @@ -74,13 +74,11 @@ const EvaluationRecommendations: FC = () => {
if ( container ) {
container.addEventListener( 'scroll', checkScrollPosition );
checkScrollPosition();
}

return () => {
if ( container ) {
return () => {
container.removeEventListener( 'scroll', checkScrollPosition );
}
};
};
}
}, [ checkScrollPosition ] );

useEffect( () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ ul.recommendations-list {
grid-column-end: unset;
}

@media screen and (max-width: 600px) {
grid-template-columns: repeat( 5, 100% );

li {
min-width: unset;
}
}

@media screen and (max-width: 1024px) {
li {
min-width: 450px;
Expand Down

0 comments on commit 69f25b6

Please sign in to comment.