mirror of
https://github.com/acid-info/logos-press-engine.git
synced 2025-02-23 14:48:08 +00:00
commit
2069dab45b
@ -22,7 +22,7 @@ export const MobileToc = ({ toc }: Props) => {
|
|||||||
key={idx}
|
key={idx}
|
||||||
active={tocId ? toc.href.substring(1) === tocId : idx === 0}
|
active={tocId ? toc.href.substring(1) === tocId : idx === 0}
|
||||||
>
|
>
|
||||||
<Typography variant="label2" genericFontFamily="sans-serif">
|
<CustomTypography variant="label2" genericFontFamily="sans-serif">
|
||||||
{toc.title}
|
{toc.title}
|
||||||
</Typography>
|
</Typography>
|
||||||
</TocItem>
|
</TocItem>
|
||||||
@ -31,6 +31,12 @@ export const MobileToc = ({ toc }: Props) => {
|
|||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CustomTypography = styled(Typography)`
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
`
|
||||||
|
|
||||||
const TocItem = styled(Link)<{ active: boolean }>`
|
const TocItem = styled(Link)<{ active: boolean }>`
|
||||||
padding: 8px 14px;
|
padding: 8px 14px;
|
||||||
background-color: ${(p) =>
|
background-color: ${(p) =>
|
||||||
|
@ -31,7 +31,8 @@ const ArticleFooter = ({ data }: { data: ArticlePostData }) => {
|
|||||||
|
|
||||||
const ArticleFooterContainer = styled.div`
|
const ArticleFooterContainer = styled.div`
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
|
|
||||||
|
& > div:not(:first-child) > div > button,
|
||||||
& > div:not(:first-child) > div {
|
& > div:not(:first-child) > div {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,26 @@ const FeaturedPost = ({ post }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<CustomGrid>
|
<CustomGrid>
|
||||||
<GridItem className="w-16">
|
<GridItem className="w-16">
|
||||||
<PostWrapper>
|
<PostLink href={`/article/${post.slug}`}>
|
||||||
<Post
|
<PostWrapper>
|
||||||
data={post}
|
<Post
|
||||||
appearance={{ imageProps: { fill: true, height: '480px' } }}
|
data={post}
|
||||||
/>
|
appearance={{
|
||||||
</PostWrapper>
|
imageProps: {
|
||||||
|
fill: true,
|
||||||
|
height: '480px',
|
||||||
|
nextImageProps: post.coverImage
|
||||||
|
? {
|
||||||
|
quality: 100,
|
||||||
|
width: post.coverImage?.width * 2,
|
||||||
|
height: post.coverImage?.height * 2,
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</PostWrapper>
|
||||||
|
</PostLink>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
</CustomGrid>
|
</CustomGrid>
|
||||||
)
|
)
|
||||||
|
@ -4,16 +4,8 @@ import styled from '@emotion/styled'
|
|||||||
export default function Hero() {
|
export default function Hero() {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Title genericFontFamily="serif" component="span" variant="h2">
|
<Title genericFontFamily="serif" component="h1" variant="h1">
|
||||||
LOGOS →{' '}
|
LOGOS → PRESS ENGINE
|
||||||
<Title
|
|
||||||
style={{ whiteSpace: 'nowrap' }}
|
|
||||||
genericFontFamily="serif"
|
|
||||||
component="span"
|
|
||||||
variant="h2"
|
|
||||||
>
|
|
||||||
PRESS ENGINE
|
|
||||||
</Title>
|
|
||||||
</Title>
|
</Title>
|
||||||
<Description component="div" variant="label2">
|
<Description component="div" variant="label2">
|
||||||
Blog with media written by Logos members
|
Blog with media written by Logos members
|
||||||
|
@ -4,19 +4,20 @@ import { useSearchBarContext } from '@/context/searchbar.context'
|
|||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
export const NavbarFiller = () => {
|
export const NavbarFiller = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { tags } = useSearchBarContext()
|
const { tags } = useSearchBarContext()
|
||||||
|
|
||||||
const onTagClick = (tag: string) => {
|
const onTagClick = (tag: string) => {
|
||||||
router.push(`/search?topics=${tag}`)
|
router.push(`/search?topics=${tag}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavbarFillerContainer>
|
<NavbarFillerContainer>
|
||||||
<FilterTags onTagClick={onTagClick} tags={tags} selectedTags={[]} />
|
<FilterTags onTagClick={onTagClick} tags={tags} selectedTags={[]} />
|
||||||
</NavbarFillerContainer>
|
</NavbarFillerContainer>
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NavbarFillerContainer = styled.div`
|
export const NavbarFillerContainer = styled.div`
|
||||||
height: var(--lpe-nav-rendered-height);
|
height: var(--lpe-nav-rendered-height);
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
@ -56,9 +56,11 @@ export const PostsList = (props: Props) => {
|
|||||||
}
|
}
|
||||||
key={index}
|
key={index}
|
||||||
>
|
>
|
||||||
<PostWrapper className={props.loading ? 'loading' : ''}>
|
<PostLink href={`/article/${post.slug}`}>
|
||||||
<Post data={post} />
|
<PostWrapper className={props.loading ? 'loading' : ''}>
|
||||||
</PostWrapper>
|
<Post data={post} />
|
||||||
|
</PostWrapper>
|
||||||
|
</PostLink>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import Image, { ImageProps } from 'next/image'
|
import Image, { ImageProps } from 'next/image'
|
||||||
import { ImageBlockEnhanced, UnbodyImageBlock } from '@/lib/unbody/unbody.types'
|
import { ImageBlockEnhanced, UnbodyImageBlock } from '@/lib/unbody/unbody.types'
|
||||||
import Imgix from 'react-imgix'
|
|
||||||
import styled from '@emotion/styled'
|
import styled from '@emotion/styled'
|
||||||
import { Blurhash } from 'react-blurhash'
|
|
||||||
|
|
||||||
export type ResponsiveImageProps = {
|
export type ResponsiveImageProps = {
|
||||||
height?: number | string
|
height?: number | string
|
||||||
nextImageProps?: ImageProps
|
nextImageProps?: Partial<ImageProps>
|
||||||
fill?: boolean
|
fill?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export type SearchbarProps = {
|
|||||||
|
|
||||||
export default function Searchbar(props: SearchbarProps) {
|
export default function Searchbar(props: SearchbarProps) {
|
||||||
const { onSearch, onReset } = props
|
const { onSearch, onReset } = props
|
||||||
const { resultsNumber, resultsHelperText } = useSearchBarContext()
|
const { resultsNumber, resultsHelperText, tags } = useSearchBarContext()
|
||||||
|
|
||||||
const [searchScope, setSearchScope] = useState<ESearchScope>(
|
const [searchScope, setSearchScope] = useState<ESearchScope>(
|
||||||
props.searchScope || ESearchScope.GLOBAL,
|
props.searchScope || ESearchScope.GLOBAL,
|
||||||
@ -178,7 +178,7 @@ export default function Searchbar(props: SearchbarProps) {
|
|||||||
{!isArticlePage && (
|
{!isArticlePage && (
|
||||||
<TagsWrapper className={active ? 'active' : ''}>
|
<TagsWrapper className={active ? 'active' : ''}>
|
||||||
<FilterTags
|
<FilterTags
|
||||||
tags={copyConfigs.search.filterTags}
|
tags={tags}
|
||||||
onTagClick={handleTagClick}
|
onTagClick={handleTagClick}
|
||||||
selectedTags={filterTags}
|
selectedTags={filterTags}
|
||||||
/>
|
/>
|
||||||
|
@ -50,8 +50,8 @@ export default function TableOfContents({ contents, ...props }: Props) {
|
|||||||
<Contents height={height}>
|
<Contents height={height}>
|
||||||
{contents?.map((content, index) => (
|
{contents?.map((content, index) => (
|
||||||
<TocItem
|
<TocItem
|
||||||
key={index}
|
|
||||||
href={`${index === 0 ? '#' : content.href}`}
|
href={`${index === 0 ? '#' : content.href}`}
|
||||||
|
key={index}
|
||||||
active={tocId ? content.href.substring(1) === tocId : index === 0}
|
active={tocId ? content.href.substring(1) === tocId : index === 0}
|
||||||
>
|
>
|
||||||
<Typography variant="label2" genericFontFamily="sans-serif">
|
<Typography variant="label2" genericFontFamily="sans-serif">
|
||||||
|
@ -16,20 +16,29 @@ import { ReactNode, useEffect, useRef, useState } from 'react'
|
|||||||
import { SearchLayout } from '@/layouts/SearchLayout'
|
import { SearchLayout } from '@/layouts/SearchLayout'
|
||||||
import { RelatedArticles } from '@/components/RelatedArticles'
|
import { RelatedArticles } from '@/components/RelatedArticles'
|
||||||
import { RelatedContent } from '@/components/RelatedContent'
|
import { RelatedContent } from '@/components/RelatedContent'
|
||||||
|
import { Section } from '@/components/Section/Section'
|
||||||
|
import api from '@/services/unbody.service'
|
||||||
|
import { useSearchBarContext } from '@/context/searchbar.context'
|
||||||
|
|
||||||
interface SearchPageProps {
|
interface SearchPageProps {
|
||||||
articles: SearchResultItem<UnbodyGoogleDoc>[]
|
articles: SearchResultItem<UnbodyGoogleDoc>[]
|
||||||
blocks: SearchResultItem<UnbodyTextBlock | UnbodyImageBlock>[]
|
blocks: SearchResultItem<UnbodyTextBlock | UnbodyImageBlock>[]
|
||||||
|
topics: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SearchPage({
|
export default function SearchPage({
|
||||||
articles: initialArticles = [],
|
articles: initialArticles = [],
|
||||||
blocks: initialBlocks = [],
|
blocks: initialBlocks = [],
|
||||||
|
topics: allTopics = [],
|
||||||
}: SearchPageProps) {
|
}: SearchPageProps) {
|
||||||
|
const { setTags } = useSearchBarContext()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const hasUpdated = useRef(false)
|
|
||||||
const [mounted, setMounted] = useState(false)
|
const [mounted, setMounted] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTags(allTopics)
|
||||||
|
}, [setTags, allTopics])
|
||||||
|
|
||||||
const {
|
const {
|
||||||
query: { query = '', topics = [] },
|
query: { query = '', topics = [] },
|
||||||
} = router
|
} = router
|
||||||
@ -82,11 +91,13 @@ SearchPage.getLayout = function getLayout(page: ReactNode) {
|
|||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
const { data: articles = [] } = await unbodyApi.searchArticles()
|
const { data: articles = [] } = await unbodyApi.searchArticles()
|
||||||
const { data: blocks = [] } = await unbodyApi.serachBlocks()
|
const { data: blocks = [] } = await unbodyApi.serachBlocks()
|
||||||
|
const { data: topics, errors: topicErrors } = await api.getTopics()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
articles,
|
articles,
|
||||||
blocks,
|
blocks,
|
||||||
|
topics,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user