style search page and results
This commit is contained in:
@ -3,6 +3,9 @@ import { useDebouncedCallback } from "use-debounce";
|
|||||||
import { PageHeader } from "../general/PageHeader";
|
import { PageHeader } from "../general/PageHeader";
|
||||||
import { useSearchParams, usePathname, useRouter } from "next/navigation";
|
import { useSearchParams, usePathname, useRouter } from "next/navigation";
|
||||||
import { getSearchPath } from "@/lib/common";
|
import { getSearchPath } from "@/lib/common";
|
||||||
|
import styles from './searchContainer.module.scss';
|
||||||
|
import Icon from "../general/Icon";
|
||||||
|
|
||||||
export function SearchContainer({
|
export function SearchContainer({
|
||||||
query,
|
query,
|
||||||
results,
|
results,
|
||||||
@ -19,8 +22,9 @@ export function SearchContainer({
|
|||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={styles.searchContainer}>
|
||||||
<PageHeader heading="Søk" />
|
<PageHeader heading="Søk" />
|
||||||
|
<div className={styles.searchField}>
|
||||||
<input
|
<input
|
||||||
name="query"
|
name="query"
|
||||||
type="text"
|
type="text"
|
||||||
@ -30,6 +34,8 @@ export function SearchContainer({
|
|||||||
onQueryChange(e.target.value);
|
onQueryChange(e.target.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<div className={styles.searchIcon}><Icon type="search" /></div>
|
||||||
|
</div>
|
||||||
{query && <SearchResults results={results} />}
|
{query && <SearchResults results={results} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -63,9 +69,9 @@ function SearchResults({ results }: { results: any }) {
|
|||||||
resultType = capitalizeFirstLetter(result?.associationType);
|
resultType = capitalizeFirstLetter(result?.associationType);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div key={result.id}>
|
<div key={result.id} className={styles.resultItem}>
|
||||||
<span>{resultType}</span>
|
<span className={styles.suphead}>{resultType}</span>
|
||||||
<span>{result.title}</span>
|
<h2 className={styles.title}>{result.title}</h2>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
39
web/src/components/search/searchContainer.module.scss
Normal file
39
web/src/components/search/searchContainer.module.scss
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
.searchContainer {
|
||||||
|
max-width: var(--size-width-lead);
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchField {
|
||||||
|
margin-top: var(--spacing-l);
|
||||||
|
width: 100%;
|
||||||
|
max-width: 24rem;
|
||||||
|
font-size: var(--font-size-lead);
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--color-deepBrick);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
padding: .8rem 3rem .8rem 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchIcon {
|
||||||
|
position: absolute;
|
||||||
|
right: 1.2rem;
|
||||||
|
bottom: .6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resultItem {
|
||||||
|
border-top: var(--border);
|
||||||
|
margin-top: var(--spacing-m);
|
||||||
|
padding-top: var(--spacing-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
.suphead {
|
||||||
|
display: block;
|
||||||
|
font-size: var(--font-size-caption);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
Reference in New Issue
Block a user