Skip to content

Commit

Permalink
Search redesign (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
AtkishkinVlad authored and sashachabin committed Dec 21, 2023
1 parent 0348b8c commit ab09861
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 34 deletions.
8 changes: 1 addition & 7 deletions components/SidePage/SidePage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@

@media screen and (min-width: 1500px) {
.SidePage__container {
width: max(410px, var(--sidebar-width));
width: var(--sidebar-width);
}
}

@media screen and (min-width: 1900px) {
.SidePage__container {
width: 502px;
}
}
8 changes: 2 additions & 6 deletions components/SidePage/Suggestions/Suggestions.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react'
import Image from 'next/image'
import Link from 'next/link'
import { useRouter } from 'next/router'

import { API_HOST } from '../../../consts/endpoints'
import styles from './Suggestions.module.css'
import { getCSSVarsColors } from '../../../utils/getCSSVarsColors'

Expand Down Expand Up @@ -38,11 +36,10 @@ const SectionSuggestion = ({ section }) => {
}

const GuideSuggestion = ({ guide }) => {
const { title, cover, sections, color } = guide
const { title, sections, color } = guide
return (
<article className={styles.GuideSuggestion} style={{ ...getCSSVarsColors(color) }}>
<div className={styles.imageContainer}>
<Image className={styles.image} fill src={`${API_HOST}/static/${cover}`} alt="" />
<h3 className={styles.GuideSuggestionTitle}>{title}</h3>
</div>
{sections?.map((section, i) => (
Expand All @@ -60,12 +57,11 @@ function getGuides({ items, currentUrl }) {
})
return items.reduce((acc, item) => {
const title = item?.properties.properties?.Name?.title[0]?.plain_text
const cover = item?.properties.properties?.previewPattern?.at(0)
const color = item?.properties.properties?.color?.rich_text[0]?.plain_text
const sections = item?.sectionSuggestions.sort((a, b) =>
collator.compare(a.sectionName, b.sectionName)
)
const guideSuggestion = { title, cover, sections, color }
const guideSuggestion = { title, sections, color }
const url = item?.properties?.properties?.pageUrl?.url
if (url !== currentUrl) {
return [...acc, guideSuggestion]
Expand Down
38 changes: 19 additions & 19 deletions components/SidePage/Suggestions/Suggestions.module.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
.SuggestionsContainer {
display: flex;
align-items: flex-start;
flex-direction: column;
gap: 8px;
align-items: flex-start;
overflow: auto;
height: calc(100vh - 100px);
height: calc(100vh - 84px);
margin-top: 8px;
gap: 8px;
margin-right: 8px;
border-radius: 16px;
color: var(--color);
}

.SuggestionsContainer::-webkit-scrollbar {
Expand All @@ -24,64 +23,65 @@
position: relative;
width: 100%;
margin-bottom: 12px;
color: var(--color);
}

.imageContainer > div {
position: static;
}

.imageContainer .image {
position: relative !important;
object-fit: contain;
width: 100% !important;
position: relative !important;
height: unset !important;
border-radius: 8px;
}

.GuideSuggestion {
padding: 24px;
padding: 12px;
border-radius: 16px;
background: hsl(var(--color-h) 72% 97%);
}

.GuideSuggestionTitle {
position: absolute;
top: 0;
margin: 12px 16px;
font-weight: 400;
margin-bottom: 0.15em;
font-size: 5vw;
top: 0;
padding: 0 16px;
text-wrap: balance;
}

.SectionSuggestion {
color: var(--color);
border-radius: 16px;
margin-bottom: 12px;
border-radius: 16px;
color: var(--color);
}

.SectionSuggestionList {
list-style: none;
padding-left: 0;
list-style: none;
}

.SectionSuggestionTitle {
margin: 12px 16px;
font-weight: 500;
font-size: 20px;
margin-left: 16px;
font-weight: 300;
font-size: 18px;
}

.SuggestItemTarget {
font-weight: 500;
font-weight: 400;
}

.SuggestItemLink {
font-size: 16px;
font-size: 14px;
text-decoration:none;
}

.SuggestItemListItem {
margin-bottom: 8px;
padding: 16px;
margin-bottom: 4px;
padding: 12px;
border-radius: 8px;
background: hsl(var(--color-h) 75% 93%);
font-weight: 300;
Expand Down
2 changes: 1 addition & 1 deletion components/TableOfContents/TableOfContents.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ html:has(.open) {
display: flex;
flex-direction: column;
position: fixed;
height: calc(100vh - 100px);
height: calc(100vh - 84px);
width: var(--sidebar-width);
overflow: auto;
scrollbar-width: none;
Expand Down
2 changes: 1 addition & 1 deletion styles/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

@media screen and (min-width: 1200px) {
:root {
--sidebar-width: 350px;
--sidebar-width: 340px;
}
}

Expand Down

0 comments on commit ab09861

Please sign in to comment.