Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove old search input #19064

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 6 additions & 86 deletions src/components/HomepageBanner.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import React, { useState } from 'react';
import { navigate } from '@reach/router';
import React from 'react';

import { css } from '@emotion/react';
import {
Link,
SearchInput,
useTranslation,
addPageAction,
} from '@newrelic/gatsby-theme-newrelic';
import { useTranslation } from '@newrelic/gatsby-theme-newrelic';
import bannerBackground from 'images/bannerBackground.svg';

const HomepageBanner = () => {
const bannerHeight = '250px';
const bannerHeight = '200px';
const mobileBreakpoint = '450px';
const { t } = useTranslation();
const [searchTerm, setSearchTerm] = useState('');

return (
<section
Expand All @@ -26,30 +19,28 @@ const HomepageBanner = () => {
background-size: cover;
background-position: center;
display: flex;
flex-direction: column;
align-items: center;
min-height: ${bannerHeight};
justify-content: center;
@media screen and (max-width: 550px) {
justify-content: center;
background-size: 150%;
background-position: center 20px;
}
@media screen and (max-width: ${mobileBreakpoint}) {
min-height: 200px;
background-size: 200%;
background-position: center 8px;
}
`}
>
<h1
css={css`
font-size: 2.5rem;
font-size: 3rem;
font-weight: 500;
color: #1ce783;
padding-top: 3rem;
margin-bottom: 1.5rem;
text-align: center;
margin: 0 20px;
line-height: 1;
@media screen and (max-width: 550px) {
Expand All @@ -63,77 +54,6 @@ const HomepageBanner = () => {
>
{t('strings.home.pageTitle')}
</h1>
<SearchInput
placeholder={t('strings.home.search.placeholder')}
size={SearchInput.SIZE.MEDIUM}
value={searchTerm || ''}
iconName={SearchInput.ICONS.SEARCH}
isIconClickable
alignIcon={SearchInput.ICON_ALIGNMENT.RIGHT}
onChange={(e) => setSearchTerm(e.target.value)}
onSubmit={() => {
addPageAction({
eventName: 'swiftypeSearchInput',
category: 'SearchInput',
searchTerm,
searchLocation: 'homepage',
});
if (searchTerm !== '') {
navigate(`search-results/?query=${searchTerm}&page=1`);
}
}}
css={css`
max-width: 880px;
width: 80%;
svg {
color: var(--primary-text-color);
}
`}
/>
<div
css={css`
margin-top: 0.75rem;
width: 40%;
color: white;
display: flex;
align-items: baseline;
justify-content: center;
width: 100%;
flex-wrap: wrap;
font-weight: 500;
font-size: 1rem;
a {
margin-left: 0.25rem;
&:hover {
color: var(--brand-button-primary-accent);
}
}
@media screen and (max-width: 550px) {
font-size: 0.75rem;
}
@media screen and (max-width: ${mobileBreakpoint}) {
display: none;
}
`}
>
<p>{t('strings.home.search.popularSearches.title')}: </p>
<Link to="/search-results/?query=nrql&page=1">
{t('strings.home.search.popularSearches.options.0')},
</Link>
<Link to="/search-results/?query=logs&page=1">
{t('strings.home.search.popularSearches.options.1')},
</Link>
<Link to="/search-results/?query=alert&page=1">
{t('strings.home.search.popularSearches.options.2')},
</Link>
<Link to="/search-results/?query=best practices&page=1">
{t('strings.home.search.popularSearches.options.3')},
</Link>
<Link to="/search-results/?query=kubernetes&page=1">
{t('strings.home.search.popularSearches.options.4')}
</Link>
</div>
</section>
);
};
Expand Down
Loading