-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1593 from kianamcc/PORTALS-3376
PORTALS-3376: [CCKP Homepage_V1] New Portal home page search component
- Loading branch information
Showing
5 changed files
with
239 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
apps/synapse-portal-framework/src/components/HeaderSearchBox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import { | ||
Box, | ||
Stack, | ||
SxProps, | ||
Typography, | ||
Button, | ||
lighten, | ||
useTheme, | ||
} from '@mui/material' | ||
import PortalFullTextSearchField from './PortalSearch/PortalFullTextSearchField' | ||
import { spreadSx } from 'synapse-react-client/theme/spreadSx' | ||
import { useSearchParams } from 'react-router' | ||
|
||
type HeaderSearchBoxProps = { | ||
searchPlaceholder?: string | ||
searchExampleTerms?: string[] | ||
path?: string | ||
sx?: SxProps | ||
} | ||
|
||
const HeaderSearchBox = ({ | ||
searchPlaceholder, | ||
searchExampleTerms, | ||
path, | ||
sx, | ||
}: HeaderSearchBoxProps) => { | ||
const [, setSearchParams] = useSearchParams() | ||
const theme = useTheme() | ||
|
||
const handleTermClick = (term: string) => { | ||
const trimmedTerm = term.trim() | ||
setSearchParams({ FTS_SEARCH_TERM: trimmedTerm }) | ||
if (path) { | ||
window.location.pathname = `${path}` | ||
} | ||
} | ||
|
||
return ( | ||
<Box | ||
sx={spreadSx(sx, { | ||
padding: { xs: '40px', lg: '40px 80px 40px 0' }, | ||
width: '100%', | ||
})} | ||
> | ||
<Stack | ||
sx={theme => ({ | ||
padding: '40px', | ||
gap: '30px', | ||
borderRadius: '6px', | ||
backdropFilter: 'blur(15px)', | ||
[theme.breakpoints.up('lg')]: { | ||
minWidth: '660px', | ||
}, | ||
})} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
gap: '20px', | ||
alignItems: 'center', | ||
height: '48px', | ||
}} | ||
> | ||
<PortalFullTextSearchField | ||
placeholder={searchPlaceholder} | ||
path={path} | ||
sx={{ | ||
margin: 0, | ||
height: '100%', | ||
borderRadius: '3px', | ||
'.MuiInputBase-root': { | ||
height: '100%', | ||
borderRadius: '3px', | ||
}, | ||
}} | ||
/> | ||
</Box> | ||
<Stack sx={{ gap: '8px' }}> | ||
<Typography sx={{ color: 'grey.900', fontWeight: 700 }}> | ||
Example searches | ||
</Typography> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexWrap: 'wrap', | ||
gap: '8px 6px;', | ||
}} | ||
> | ||
{searchExampleTerms && | ||
searchExampleTerms.map(term => ( | ||
<Button | ||
variant="contained" | ||
onClick={() => handleTermClick(term)} | ||
sx={{ | ||
borderRadius: '30px', | ||
border: '1px solid', | ||
borderColor: lighten(theme.palette.primary.main, 0.9), | ||
padding: '7px 9px', | ||
textDecoration: 'none !important', | ||
backgroundColor: lighten(theme.palette.primary.main, 0.8), | ||
'&:hover': { | ||
background: lighten(theme.palette.primary.main, 0.7), | ||
}, | ||
}} | ||
> | ||
<Typography | ||
sx={{ | ||
color: 'grey.800', | ||
fontSize: '16px', | ||
}} | ||
> | ||
{term} | ||
</Typography> | ||
</Button> | ||
))} | ||
</Box> | ||
</Stack> | ||
</Stack> | ||
</Box> | ||
) | ||
} | ||
|
||
export default HeaderSearchBox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
apps/synapse-portal-framework/src/components/cancercomplexity/CancerComplexityHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { Box, Typography } from '@mui/material' | ||
import HeaderSearchBox from '../HeaderSearchBox' | ||
|
||
const CancerComplexityHeader = () => { | ||
const searchPlaceholder = 'Search for cancer related data and resources' | ||
const searchExampleTerms = [ | ||
'Justo Turpis', | ||
'Nostra', | ||
'Fames', | ||
'Rhoncus', | ||
'Pharetra enim', | ||
'Aliquet', | ||
'Ridiculus', | ||
'Penatibus', | ||
'Accumsan quisque', | ||
'Patient Advocacy', | ||
] | ||
const content = ( | ||
<> | ||
<Box | ||
sx={{ | ||
margin: 0, | ||
color: '#FFFF', | ||
}} | ||
> | ||
<Typography | ||
variant="headline1" | ||
sx={{ | ||
fontSize: { xs: '42px', md: '48px' }, | ||
fontWeight: 'bold', | ||
marginBottom: '15px', | ||
lineHeight: '54px', | ||
}} | ||
> | ||
Welcome to the Cancer Complexity Knowledge Portal | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
sx={{ fontSize: '18px', lineHeight: '144%' }} | ||
> | ||
The NCI Division of Cancer Biology supports multiple research programs | ||
composed of interdisciplinary communities of scientists who aim to | ||
integrate approaches, data, and tools to address important questions | ||
in basic and translational cancer research. Discover and download | ||
datasets, publications, and other resources generated by these | ||
programs. | ||
</Typography> | ||
</Box> | ||
</> | ||
) | ||
return ( | ||
<header id="header"> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: { xs: 'column', lg: 'row' }, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
padding: '20px 0', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
margin: 0, | ||
flex: 1, | ||
padding: { xs: '40px', lg: '40px 80px' }, | ||
}} | ||
> | ||
{content} | ||
</Box> | ||
<HeaderSearchBox | ||
searchExampleTerms={searchExampleTerms} | ||
searchPlaceholder={searchPlaceholder} | ||
path="/Search" | ||
sx={{ | ||
flex: 1, | ||
'& > :first-child': { | ||
background: 'rgba(184, 204, 226, 0.60)', | ||
}, | ||
}} | ||
/> | ||
</Box> | ||
</header> | ||
) | ||
} | ||
|
||
export default CancerComplexityHeader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters