Skip to content

Commit

Permalink
clean import, and add horizontal line below tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-hodgson committed Jan 10, 2025
1 parent 7204435 commit 3c075a6
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 68 deletions.
2 changes: 1 addition & 1 deletion apps/portals/cancercomplexity/src/config/routesConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
onIndividualThemeBarPlotPointClick,
onPointClick,
} from './synapseConfigs/onPointClick'
import { CCKPSearchPage, searchPageChildRoutes } from 'src/pages/CCKPSearchPage'
import { searchPageChildRoutes } from 'src/pages/CCKPSearchPage'

const routes: RouteObject[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,72 +18,85 @@ export function PortalSearchTabs(props: PortalSearchTabUIProps) {
const isMobileView = useMediaQuery(theme.breakpoints.down('sm'))
const navigate = useNavigate()
return (
<Tabs
value={location.pathname}
variant="scrollable"
orientation={isMobileView ? 'vertical' : 'horizontal'}
scrollButtons="auto"
ScrollButtonComponent={CustomScrollButton}
aria-label="Search Object Types"
sx={{
'.MuiTabs-flexContainer': {
gap: { xs: 2, sm: 5 },
alignItems: 'center',
},
}}
TabIndicatorProps={{
style: { background: 'transparent' },
}}
>
{tabConfig.map(({ path, title, count }) => {
const targetPathname = `/Search/${path}`
return (
<Tab
key={path}
value={encodeURI(targetPathname)}
label={
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
{title}{' '}
{count !== undefined && (
<Chip
label={count}
size="small"
sx={{
backgroundColor: 'grey.100',
color: 'grey.900',
height: '21px',
}}
/>
)}
</Box>
}
onClick={() =>
navigate({
pathname: targetPathname,
search: location.search,
})
}
sx={{
transition: 'all 400ms',
fontSize: '16px',
fontWeight: 700,
color: 'grey.700',
minWidth: { xs: '100%', sm: 'unset' },
py: 1,
px: 0,
borderBottom: '4px solid',
borderBottomColor: 'transparent',
'&.Mui-selected': {
color: 'secondary.main',
borderBottomColor: 'secondary.main',
},
'&:hover:not(.Mui-selected)': {
color: 'grey.800',
},
}}
/>
)
})}
</Tabs>
<>
<Tabs
value={location.pathname}
variant="scrollable"
orientation={isMobileView ? 'vertical' : 'horizontal'}
scrollButtons="auto"
ScrollButtonComponent={CustomScrollButton}
aria-label="Search Object Types"
sx={{
'.MuiTabs-flexContainer': {
gap: { xs: 2, sm: 5 },
alignItems: 'center',
},
}}
TabIndicatorProps={{
style: {
background: 'transparent',
marginTop: '4px',
position: 'relative',
},
}}
>
{tabConfig.map(({ path, title, count }) => {
const targetPathname = `/Search/${path}`
return (
<Tab
key={path}
value={encodeURI(targetPathname)}
label={
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
{title}{' '}
{count !== undefined && (
<Chip
label={count}
size="small"
sx={{
backgroundColor: 'grey.100',
color: 'grey.900',
height: '21px',
}}
/>
)}
</Box>
}
onClick={() =>
navigate({
pathname: targetPathname,
search: location.search,
})
}
sx={{
transition: 'all 400ms',
fontSize: '16px',
fontWeight: 700,
color: 'grey.700',
minWidth: { xs: '100%', sm: 'unset' },
py: 1,
px: 0,
borderBottom: '4px solid',
borderBottomColor: 'transparent',
'&.Mui-selected': {
color: 'secondary.main',
borderBottomColor: 'secondary.main',
},
'&:hover:not(.Mui-selected)': {
color: 'grey.800',
},
}}
/>
)
})}
</Tabs>
<Box
sx={{
borderTop: '4px solid',
borderColor: 'grey.400',
mt: '-4px',
}}
/>
</>
)
}

0 comments on commit 3c075a6

Please sign in to comment.