Skip to content

Commit

Permalink
Update algolia search results styles and structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jdwjdwjdw committed Nov 22, 2023
1 parent ccf2781 commit 6ac1d80
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ const Hit = ({hit}) => {

const Container = styled.div`
li {
margin-bottom: 40px;
margin-bottom: 30px;
border-bottom: 1px solid black;
&:last-child {
border-bottom: none;
}
}
`

Expand Down
21 changes: 10 additions & 11 deletions themes/stanford_basic/algolia-search/src/hits/default-hit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ import {Highlight, Snippet} from "react-instantsearch";
const HitContainer = styled.article`
display: flex;
flex-direction: column;
gap: 40px;
justify-content: left;
padding: 20px;
margin-bottom: 20px;
justify-content: space-between;
gap: 4rem;
padding: 2rem 2rem 2rem 0;
margin-bottom: 2rem;
@media (min-width: 768px) {
flex-direction: row;
}
img {
max-width: 200px;
max-height: 200px;
max-width: 300px;
max-height: 300px;
object-fit: cover;
aspect-ratio: 1;
}
`

Expand All @@ -31,10 +30,7 @@ const DefaultHit = ({hit}) => {
const hitUrl = new URL(hit.url);

return (
<HitContainer className="su-card">
{hit.photo &&
<img src={hit.photo.replace(hitUrl.origin, '')} alt=""/>
}
<HitContainer>
<DetailsContainer>
<div>
<h2>
Expand Down Expand Up @@ -62,6 +58,9 @@ const DefaultHit = ({hit}) => {
</div>
}
</DetailsContainer>
{hit.photo &&
<img src={hit.photo.replace(hitUrl.origin, '')} alt=""/>
}
</HitContainer>
)
}
Expand Down
2 changes: 1 addition & 1 deletion themes/stanford_basic/algolia-search/src/search-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const SearchBox = (props) => {
autoFocus
/>
</div>
<div style={{display: "flex", gap: "10px"}}>
<div style={{display: "flex", gap: "1rem", marginTop: "1rem"}}>
<button type="submit">Submit</button>
<button
type="reset"
Expand Down

0 comments on commit 6ac1d80

Please sign in to comment.