From b367fe4e2108d4faeaeb7d5ccba9d1b0d97e85cb Mon Sep 17 00:00:00 2001 From: Johnny Bouder Date: Wed, 31 Jul 2024 13:14:55 -0400 Subject: [PATCH 1/3] Add govai search button. --- src/components/search/search.tsx | 24 ++++++++++++++++++++---- src/pages/home/home.tsx | 6 +++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/components/search/search.tsx b/src/components/search/search.tsx index d0e143d..12cf1be 100644 --- a/src/components/search/search.tsx +++ b/src/components/search/search.tsx @@ -1,29 +1,45 @@ -import { TextInput } from '@metrostar/comet-uswds'; +import { Button, TextInput } from '@metrostar/comet-uswds'; import React, { KeyboardEvent } from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; export const Search = (): React.ReactElement => { const navigate = useNavigate(); const [searchParams] = useSearchParams(); + const [currentSearch, setCurrentSearch] = React.useState(''); + + const handleSearchClick = () => { + navigate(`/results?search=${currentSearch}`); + }; + const handleSearch = (event: KeyboardEvent): void => { if (event.key !== 'Enter') { return; } - const value = (event.target as HTMLInputElement).value; navigate(`/results?search=${value}`); }; return (
-
+
setCurrentSearch(event.target.value)} autoFocus > +
); diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 5d7a987..aeac147 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -6,7 +6,11 @@ export const Home = (): React.ReactElement => {
-

Awards Simple Search

+

Simple Search

+
+ Popular searches: Topic 1, Topic 2,{' '} + Topic 3 +
From ee1b2117fc7f93e1b7a665368bf0df400d4f5b11 Mon Sep 17 00:00:00 2001 From: Johnny Bouder Date: Wed, 31 Jul 2024 13:30:17 -0400 Subject: [PATCH 2/3] Add ai optimized button and modal. --- public/img/ai-spark-icon.svg | 4 +++ src/components/header/header.tsx | 41 ++++++++++++++++++++++++- src/providers/uswds/uswds-settings.scss | 10 +++--- 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 public/img/ai-spark-icon.svg diff --git a/public/img/ai-spark-icon.svg b/public/img/ai-spark-icon.svg new file mode 100644 index 0000000..490811a --- /dev/null +++ b/public/img/ai-spark-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 9cb095b..d9c5b2f 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,8 +1,9 @@ -import { Banner, Icon, Search } from '@metrostar/comet-uswds'; +import { Banner, Button, Icon, Modal, Search } from '@metrostar/comet-uswds'; import { APP_TITLE } from '@src/utils/constants'; import navigation from '@uswds/uswds/js/usa-header'; import React, { SyntheticEvent, useEffect, useState } from 'react'; import { NavLink, useLocation, useNavigate } from 'react-router-dom'; +import icon from '/img/ai-spark-icon.svg'; export const Header = (): React.ReactElement => { const navigate = useNavigate(); @@ -64,6 +65,44 @@ export const Header = (): React.ReactElement => {
    +
  • + + +

    + The National Science Foundation (NSF) is committed to making + scientific research accessible to all. Our website has been + GenAI optimized, meaning it has been designed to be easily + understood and utilized by advanced AI systems, such as + language models (LLMs). This optimization helps ensure that + both human users and AI systems can access accurate, + reliable information about NSF-funded research. +

    +

    + To learn more about how the NSF uses GenAI optimization to + improve your experience and promote science literacy, visit + our GenAI Optimization Information Page. +

    +
    +
  • Date: Wed, 31 Jul 2024 13:30:56 -0400 Subject: [PATCH 3/3] Fix test. --- src/pages/home/home.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/home.test.tsx b/src/pages/home/home.test.tsx index 6b5420e..19b96c1 100644 --- a/src/pages/home/home.test.tsx +++ b/src/pages/home/home.test.tsx @@ -20,7 +20,7 @@ describe('Home', () => { await act(async () => { expect(baseElement).toBeTruthy(); expect(baseElement.querySelector('h1')?.textContent).toEqual( - 'Awards Simple Search', + 'Simple Search', ); }); });