Skip to content

Commit

Permalink
fix: adjusting tablet breakpoint to change views at 1079px
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmcadoo committed Jan 7, 2022
1 parent d81269b commit 86ef387
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
24 changes: 1 addition & 23 deletions src/components/PackTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import {
import { SHIELD_LEVELS, RESERVED_QUICKSTART_IDS } from '../data/constants';
import PackImg from './PackImg';

const IMAGE_BREAKPOINT = '1080px';

const VIEWS = {
GRID: 'Grid view',
LIST: 'List view',
Expand Down Expand Up @@ -92,18 +90,6 @@ const PackTile = ({
'summary summary'
'. tag';
/* Grid view without logo */
${!isListView() &&
css`
@media screen and (max-width: ${IMAGE_BREAKPOINT}) {
grid-template-rows: var(--title-row-height) 1fr 1fr;
grid-template-areas:
'title title'
'summary summary'
'. tag';
}
`}
/* List view */
${isListView() &&
css`
Expand Down Expand Up @@ -132,18 +118,10 @@ const PackTile = ({
css={css`
align-items: center;
display: flex;
grid-area: logo;
height: 100%;
justify-content: center;
margin-bottom: 1rem;
${isListView() &&
css`
margin-right: 0.5rem;
`}
.dark-mode & {
background-color: white;
}
grid-area: logo;
`}
>
<div
Expand Down
1 change: 1 addition & 0 deletions src/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ export const RESERVED_QUICKSTART_IDS = {
};

export const QUICKSTARTS_COLLAPSE_BREAKPOINT = '760px';
export const LISTVIEW_BREAKPOINT = '1080px';
7 changes: 5 additions & 2 deletions src/pages/instant-observability.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
QUICKSTARTS_REPO,
RESERVED_QUICKSTART_IDS,
QUICKSTARTS_COLLAPSE_BREAKPOINT,
LISTVIEW_BREAKPOINT,
} from '../data/constants';
import CATEGORIES from '../data/instant-observability-categories';

Expand Down Expand Up @@ -94,7 +95,9 @@ const QuickstartsPage = ({ data, location }) => {
const searchParam = params.get('search');
const categoryParam = params.get('category');

if (isMobile) {
// Forcing view to List View if device is < 1080px.
const width = window.innerWidth;
if (width < LISTVIEW_BREAKPOINT) {
setView(VIEWS.LIST);
}

Expand Down Expand Up @@ -371,7 +374,7 @@ const QuickstartsPage = ({ data, location }) => {
});
}}
css={css`
@media screen and (max-width: ${QUICKSTARTS_COLLAPSE_BREAKPOINT}) {
@media screen and (max-width: ${LISTVIEW_BREAKPOINT}) {
display: none;
}
`}
Expand Down

0 comments on commit 86ef387

Please sign in to comment.