Skip to content

Commit

Permalink
feat: get I/O mobile view to look correct to the designs
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmcadoo committed Jan 7, 2022
1 parent 9c3183b commit 542f7a2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/IOBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const BannerHeaderContent = () => (
<body
css={css`
background: none;
color: var(--color-brand-300);
color: var(--color-brand-100);
@media (max-width: ${MOBILE_BREAKPOINT}) {
font-size: 12px;
Expand Down
43 changes: 26 additions & 17 deletions src/components/PackTile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import useMobileDetect from 'use-mobile-detect-hook';

import { css } from '@emotion/react';
import {
Expand Down Expand Up @@ -34,6 +35,8 @@ const PackTile = ({
}) => {
const tessen = useTessen();

const isMobile = useMobileDetect().isMobile();

const handlePackClick = (quickstartId) => {
switch (true) {
case quickstartId === RESERVED_QUICKSTART_IDS.GUIDED_INSTALL:
Expand Down Expand Up @@ -104,37 +107,34 @@ const PackTile = ({
/* List view */
${isListView() &&
css`
grid-template-columns: 0.5fr 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
grid-template-areas:
'logo title title'
'logo summary summary'
'logo tag tag';
grid-template-rows: auto;
`}
/* List view without logo */
@media screen and (max-width: ${IMAGE_BREAKPOINT}) {
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
grid-template-areas:
'title title'
'summary summary'
'tag tag';
}
${isMobile &&
css`
grid-template-areas:
'logo title title'
'logo summary summary';
'logo summary summary';
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 0.5fr 1fr;
padding: 0.2rem;
`}
`}
onClick={() => handlePackClick(id)}
>
<div
css={css`
display: flex;
align-items: center;
display: flex;
height: 100%;
justify-content: center;
margin-bottom: 1rem;
height: 100%;
@media screen and (max-width: ${IMAGE_BREAKPOINT}) {
display: none;
}
${isListView() &&
css`
Expand Down Expand Up @@ -164,6 +164,14 @@ const PackTile = ({
<h4
css={css`
grid-area: title;
${isMobile &&
css`
align-self: end;
font-size: 14px;
font-weight: 300;
margin: 0;
`}
`}
>
{title}{' '}
Expand Down Expand Up @@ -198,8 +206,9 @@ const PackTile = ({
span {
color: var(--color-brand-500);
}
grid-area: tag;
${isMobile && 'display: none'}
`}
>
{featured && (
Expand Down
25 changes: 16 additions & 9 deletions src/pages/instant-observability.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ const QuickstartsPage = ({ data, location }) => {
const searchParam = params.get('search');
const categoryParam = params.get('category');

if (isMobile) {
setView(VIEWS.LIST);
}

setSearch(searchParam);
setCategory(categoryParam || '');
if (searchParam || categoryParam) {
Expand Down Expand Up @@ -126,6 +130,8 @@ const QuickstartsPage = ({ data, location }) => {

navigate(`?${params.toString()}`);
}

closeCategoriesOverlay();
};

useDebounce(
Expand Down Expand Up @@ -173,10 +179,10 @@ const QuickstartsPage = ({ data, location }) => {
* Finds display name for selected category.
* @returns {String} Display name for results found.
*/
const getDisplayName = () => {
const getDisplayName = (defaultName = 'All quickstarts') => {
const found = CATEGORIES.find((cat) => cat.value === category);

if (!found.value) return 'All quickstarts';
if (!found.value) return defaultName;

return found.displayName;
};
Expand Down Expand Up @@ -384,13 +390,12 @@ const QuickstartsPage = ({ data, location }) => {
color: var(--primary-text-color);
font-size: 12px;
justify-content: flex-start;
margin: 0.5rem 1rem 0 0;
padding: 8px;
`}
variant={Button.VARIANT.LINK}
onClick={() => setIsCategoriesOverlayOpen(true)}
>
Filter by category
{getDisplayName('Filter by Category')}
</Button>
<Overlay
isOpen={isCategoriesOverlayOpen}
Expand Down Expand Up @@ -466,7 +471,7 @@ const QuickstartsPage = ({ data, location }) => {
onClick={closeCategoriesOverlay}
variant={Button.VARIANT.PRIMARY}
>
OK
Cancel
</Button>
</div>
</div>
Expand All @@ -493,10 +498,12 @@ const QuickstartsPage = ({ data, location }) => {
}
`}
>
<span>
Showing {filteredQuickstarts.length} results for:{' '}
<strong>{search || getDisplayName()}</strong>
</span>
{!isMobile && (
<span>
Showing {filteredQuickstarts.length} results for:{' '}
<strong>{search || getDisplayName()}</strong>
</span>
)}
</div>
<div
css={css`
Expand Down

0 comments on commit 542f7a2

Please sign in to comment.