Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes from Pooja's comments
  • Loading branch information
attfarhan committed Oct 2, 2020
1 parent 5458764 commit 178510a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion web/src/repogroups/RepogroupPage.scss
Expand Up @@ -13,7 +13,7 @@
}

&__logo-container {
margin-top: 4rem;
margin-top: 6rem;
}

&__container {
Expand Down
14 changes: 9 additions & 5 deletions web/src/repogroups/RepogroupPage.tsx
Expand Up @@ -58,7 +58,6 @@ export interface RepogroupPageProps

/** Whether globbing is enabled for filters. */
globbing: boolean
lowProfile?: boolean
}

export const RepogroupPage: React.FunctionComponent<RepogroupPageProps> = (props: RepogroupPageProps) => {
Expand Down Expand Up @@ -97,7 +96,7 @@ export const RepogroupPage: React.FunctionComponent<RepogroupPageProps> = (props
text={props.repogroupMetadata.title}
/>
<div className="repogroup-page__subheading">
{props.lowProfile ? (
{props.repogroupMetadata.lowProfile ? (
<>{props.repogroupMetadata.description}</>
) : (
<span className="text-monospace">
Expand All @@ -107,13 +106,18 @@ export const RepogroupPage: React.FunctionComponent<RepogroupPageProps> = (props
)}
</div>
<div className="repogroup-page__container">
{props.lowProfile ? (
<SearchPageInput {...props} hiddenQuerySuffix={repogroupQuery} source="repogroupPage" />
{props.repogroupMetadata.lowProfile ? (
<SearchPageInput
{...props}
hiddenQueryPrefix={repogroupQuery}
source="repogroupPage"
hideVersionContexts={true}
/>
) : (
<SearchPageInput {...props} queryPrefix={repogroupQuery} source="repogroupPage" />
)}
</div>
{!props.lowProfile && (
{!props.repogroupMetadata.lowProfile && (
<div className="row">
<div className="repogroup-page__column col-xs-12 col-lg-7">
<p className="repogroup-page__content-description h5 font-weight-normal mb-4">
Expand Down
5 changes: 3 additions & 2 deletions web/src/repogroups/cncf.tsx
Expand Up @@ -8,13 +8,14 @@ export const cncf: RepogroupMetadata = {
description: (
<>
Search the{' '}
<a href="https://landscape.cncf.io/format=card-mode&project=hosted" target="_blank" rel="noopener noreferrer">
67 CNCF projects
<a href="https://landscape.cncf.io/project=hosted" target="_blank" rel="noopener noreferrer">
CNCF projects
</a>
.
</>
),
examples: [],
homepageDescription: 'Search CNCF projects',
homepageIcon: 'https://github.com/cncf/artwork/blob/master/other/cncf/icon/color/cncf-icon-color.png?raw=true',
lowProfile: true,
}
5 changes: 5 additions & 0 deletions web/src/repogroups/types.ts
Expand Up @@ -39,4 +39,9 @@ export interface RepogroupMetadata {
* A description when displayed on the search homepage.
*/
homepageDescription: string

/**
* Whether to display this in a minimal repogroup page, without examples/repositories/descriptions below the search bar.
*/
lowProfile?: boolean
}
2 changes: 1 addition & 1 deletion web/src/routes.tsx
Expand Up @@ -215,7 +215,7 @@ export const routes: readonly LayoutRouteProps<any>[] = [
},
{
path: '/cncf',
render: props => <RepogroupPage {...props} repogroupMetadata={cncf} lowProfile={true} />,
render: props => <RepogroupPage {...props} repogroupMetadata={cncf} />,
condition: props => window.context.sourcegraphDotComMode,
},
{
Expand Down
28 changes: 16 additions & 12 deletions web/src/search/input/SearchPageInput.tsx
Expand Up @@ -68,7 +68,9 @@ interface Props
/** A query fragment to appear at the beginning of the input. */
queryPrefix?: string
/** A query fragment to be appended to queries. This will not appear in the input until a search is submitted. */
hiddenQuerySuffix?: string
hiddenQueryPrefix?: string
/** Don't show the version contexts dropdown. */
hideVersionContexts?: boolean
autoFocus?: boolean
}

Expand Down Expand Up @@ -238,8 +240,8 @@ export const SearchPageInput: React.FunctionComponent<Props> = (props: Props) =>
event?.preventDefault()
submitSearch({
...props,
query: props.hiddenQuerySuffix
? `${userQueryState.query} ${props.hiddenQuerySuffix}`
query: props.hiddenQueryPrefix
? `${props.hiddenQueryPrefix} ${userQueryState.query}`
: userQueryState.query,
source: 'home',
searchParameters: tourWasActive ? [{ key: 'onboardingTour', value: 'true' }] : undefined,
Expand All @@ -265,15 +267,17 @@ export const SearchPageInput: React.FunctionComponent<Props> = (props: Props) =>
{props.splitSearchModes && (
<SearchModeToggle {...props} interactiveSearchMode={props.interactiveSearchMode} />
)}
<VersionContextDropdown
history={props.history}
caseSensitive={props.caseSensitive}
patternType={props.patternType}
navbarSearchQuery={userQueryState.query}
versionContext={props.versionContext}
setVersionContext={props.setVersionContext}
availableVersionContexts={props.availableVersionContexts}
/>
{!props.hideVersionContexts && (
<VersionContextDropdown
history={props.history}
caseSensitive={props.caseSensitive}
patternType={props.patternType}
navbarSearchQuery={userQueryState.query}
versionContext={props.versionContext}
setVersionContext={props.setVersionContext}
availableVersionContexts={props.availableVersionContexts}
/>
)}
<LazyMonacoQueryInput
{...props}
hasGlobalQueryBehavior={true}
Expand Down

0 comments on commit 178510a

Please sign in to comment.