feed-styles-refactored
This commit is contained in:
parent
807673d919
commit
f1ff06bc1d
|
@ -36,6 +36,7 @@ import { CommentsTree } from './CommentsTree'
|
||||||
import { SharePopup, getShareUrl } from './SharePopup'
|
import { SharePopup, getShareUrl } from './SharePopup'
|
||||||
import { ShoutRatingControl } from './ShoutRatingControl'
|
import { ShoutRatingControl } from './ShoutRatingControl'
|
||||||
|
|
||||||
|
import stylesFeed from '../Feed/Feed.module.scss'
|
||||||
import stylesHeader from '../HeaderNav/Header.module.scss'
|
import stylesHeader from '../HeaderNav/Header.module.scss'
|
||||||
import styles from './Article.module.scss'
|
import styles from './Article.module.scss'
|
||||||
|
|
||||||
|
@ -429,7 +430,7 @@ export const FullArticle = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Show when={props.article.layout === 'image'}>
|
<Show when={props.article.layout === 'image'}>
|
||||||
<div class="floor floor--important">
|
<div class={clsx(stylesFeed.floor, stylesFeed['floor--important'])}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-20 offset-md-2">
|
<div class="col-md-20 offset-md-2">
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
// TODO: additional entities list column + article
|
// TODO: additional entities list column + article
|
||||||
|
|
||||||
import type { Author, Shout, Topic } from '~/graphql/schema/core.gen'
|
|
||||||
|
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { For, Show } from 'solid-js'
|
import { For, Show } from 'solid-js'
|
||||||
import { useLocalize } from '~/context/localize'
|
import { useLocalize } from '~/context/localize'
|
||||||
|
import type { Author, Shout, Topic } from '~/graphql/schema/core.gen'
|
||||||
import { AuthorBadge } from '../Author/AuthorBadge'
|
import { AuthorBadge } from '../Author/AuthorBadge'
|
||||||
import { TopicCard } from '../Topic/Card'
|
import { TopicCard } from '../Topic/Card'
|
||||||
import { Icon } from '../_shared/Icon'
|
import { Icon } from '../_shared/Icon'
|
||||||
|
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
|
|
||||||
import styles from './Beside.module.scss'
|
import styles from './Beside.module.scss'
|
||||||
|
import stylesFeed from './Feed.module.scss'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
title?: string
|
title?: string
|
||||||
|
@ -31,7 +30,7 @@ export const Beside = (props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show when={!!props.beside?.slug && props.values?.length > 0}>
|
<Show when={!!props.beside?.slug && props.values?.length > 0}>
|
||||||
<div class="floor floor--9">
|
<div class={clsx(stylesFeed.floor, stylesFeed['floor--9'])}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row justify-content-between">
|
<div class="row justify-content-between">
|
||||||
<Show when={!!props.values}>
|
<Show when={!!props.values}>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
import clsx from 'clsx'
|
||||||
|
import { For, Show } from 'solid-js'
|
||||||
import type { JSX } from 'solid-js/jsx-runtime'
|
import type { JSX } from 'solid-js/jsx-runtime'
|
||||||
import type { Shout } from '~/graphql/schema/core.gen'
|
import type { Shout } from '~/graphql/schema/core.gen'
|
||||||
|
|
||||||
import { For, Show } from 'solid-js'
|
|
||||||
|
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
import './Group.scss'
|
|
||||||
|
import stylesFeed from './Feed.module.scss'
|
||||||
|
import styles from './Group.module.scss'
|
||||||
|
|
||||||
interface GroupProps {
|
interface GroupProps {
|
||||||
articles: Shout[]
|
articles: Shout[]
|
||||||
|
@ -13,11 +15,11 @@ interface GroupProps {
|
||||||
|
|
||||||
export default (props: GroupProps) => {
|
export default (props: GroupProps) => {
|
||||||
return (
|
return (
|
||||||
<div class="floor floor--group">
|
<div class={clsx(stylesFeed.floor, styles['floor--group'])}>
|
||||||
<Show when={props.articles.length > 4}>
|
<Show when={props.articles.length > 4}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="group__header col-24">{props.header}</div>
|
<div class="col-24">{props.header}</div>
|
||||||
|
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<ArticleCard
|
<ArticleCard
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Shout } from '~/graphql/schema/core.gen'
|
import clsx from 'clsx'
|
||||||
|
|
||||||
import { Show } from 'solid-js'
|
import { Show } from 'solid-js'
|
||||||
|
import type { Shout } from '~/graphql/schema/core.gen'
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
|
import stylesFeed from './Feed.module.scss'
|
||||||
|
|
||||||
export const Row1 = (props: {
|
export const Row1 = (props: {
|
||||||
article: Shout
|
article: Shout
|
||||||
|
@ -11,7 +11,7 @@ export const Row1 = (props: {
|
||||||
noauthor?: boolean
|
noauthor?: boolean
|
||||||
}) => (
|
}) => (
|
||||||
<Show when={!!props.article}>
|
<Show when={!!props.article}>
|
||||||
<div class="floor floor--one-article">
|
<div class={clsx(stylesFeed.floor, stylesFeed['floor--1'])}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-24">
|
<div class="col-24">
|
||||||
|
|
|
@ -3,6 +3,7 @@ import type { Shout } from '~/graphql/schema/core.gen'
|
||||||
import { For, Show, createEffect, createSignal } from 'solid-js'
|
import { For, Show, createEffect, createSignal } from 'solid-js'
|
||||||
|
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
|
import stylesFeed from './Feed.module.scss'
|
||||||
|
|
||||||
const columnSizes = ['col-md-12', 'col-md-8', 'col-md-16']
|
const columnSizes = ['col-md-12', 'col-md-8', 'col-md-16']
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ export const Row2 = (props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show when={props.articles && props.articles.length > 0}>
|
<Show when={props.articles && props.articles.length > 0}>
|
||||||
<div class="floor">
|
<div class={stylesFeed.floor}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<For each={props.articles}>
|
<For each={props.articles}>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import type { Shout } from '~/graphql/schema/core.gen'
|
||||||
import { For, Show } from 'solid-js'
|
import { For, Show } from 'solid-js'
|
||||||
|
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
|
import stylesFeed from './Feed.module.scss'
|
||||||
|
|
||||||
export const Row3 = (props: {
|
export const Row3 = (props: {
|
||||||
articles: Shout[]
|
articles: Shout[]
|
||||||
|
@ -14,11 +15,11 @@ export const Row3 = (props: {
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Show when={props.articles && props.articles.length > 0}>
|
<Show when={props.articles && props.articles.length > 0}>
|
||||||
<div class="floor">
|
<div class={stylesFeed.floor}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<Show when={props.header}>
|
<Show when={props.header}>
|
||||||
<div class="floor-header">{props.header}</div>
|
<div class={stylesFeed['floor-header']}>{props.header}</div>
|
||||||
</Show>
|
</Show>
|
||||||
<For each={props.articles}>
|
<For each={props.articles}>
|
||||||
{(a) => (
|
{(a) => (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import clsx from 'clsx'
|
||||||
import type { Shout } from '~/graphql/schema/core.gen'
|
import type { Shout } from '~/graphql/schema/core.gen'
|
||||||
|
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
|
import stylesFeed from './Feed.module.scss'
|
||||||
|
|
||||||
export const Row5 = (props: { articles: Shout[]; nodate?: boolean }) => {
|
export const Row5 = (props: { articles: Shout[]; nodate?: boolean }) => {
|
||||||
return (
|
return (
|
||||||
<div class="floor floor--1">
|
<div class={clsx(stylesFeed.floor, stylesFeed['floor--1'])}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
|
|
@ -2,10 +2,11 @@ import { For } from 'solid-js'
|
||||||
import type { Shout } from '~/graphql/schema/core.gen'
|
import type { Shout } from '~/graphql/schema/core.gen'
|
||||||
import { ArticleCard } from './ArticleCard'
|
import { ArticleCard } from './ArticleCard'
|
||||||
|
|
||||||
|
import clsx from 'clsx'
|
||||||
import styles from '~/styles/views/Feed.module.scss'
|
import styles from '~/styles/views/Feed.module.scss'
|
||||||
|
|
||||||
export default (props: { articles: Shout[] }) => (
|
export default (props: { articles: Shout[] }) => (
|
||||||
<div class="floor floor--7">
|
<div class={clsx(styles.floor, styles['floor--7'])}>
|
||||||
<div class="wide-container">
|
<div class="wide-container">
|
||||||
<div class={styles['short-cards']}>
|
<div class={styles['short-cards']}>
|
||||||
<For each={props.articles}>
|
<For each={props.articles}>
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
import { For, Show, createSignal, onMount } from 'solid-js'
|
|
||||||
|
|
||||||
import { useSearchParams } from '@solidjs/router'
|
import { useSearchParams } from '@solidjs/router'
|
||||||
import { useFeed } from '~/context/feed'
|
import clsx from 'clsx'
|
||||||
|
import { For, Show, createSignal, onMount } from 'solid-js'
|
||||||
|
import { SHOUTS_PER_PAGE, useFeed } from '~/context/feed'
|
||||||
import { useLocalize } from '~/context/localize'
|
import { useLocalize } from '~/context/localize'
|
||||||
import type { SearchResult } from '~/graphql/schema/core.gen'
|
import type { SearchResult, Shout } from '~/graphql/schema/core.gen'
|
||||||
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
|
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
|
||||||
import { ArticleCard } from '../Feed/ArticleCard'
|
import { ArticleCard } from '../Feed/ArticleCard'
|
||||||
|
import { LoadMoreItems, LoadMoreWrapper } from '../_shared/LoadMoreWrapper'
|
||||||
|
|
||||||
import '~/styles/views/Search.module.scss'
|
import styles from '~/styles/views/Search.module.scss'
|
||||||
|
import stylesFeed from '../Feed/Feed.module.scss'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
query: string
|
query: string
|
||||||
|
@ -31,19 +33,22 @@ export const SearchView = (props: Props) => {
|
||||||
|
|
||||||
const loadMore = async () => {
|
const loadMore = async () => {
|
||||||
saveScrollPosition()
|
saveScrollPosition()
|
||||||
|
let result: Shout[] = []
|
||||||
if (query()) {
|
if (query()) {
|
||||||
console.log(query())
|
console.log(query())
|
||||||
const { hasMore } = await loadShoutsSearch({
|
const { hasMore, newShouts } = await loadShoutsSearch({
|
||||||
text: query(),
|
text: query(),
|
||||||
offset: offset(),
|
offset: offset(),
|
||||||
limit: LOAD_MORE_PAGE_SIZE
|
limit: LOAD_MORE_PAGE_SIZE
|
||||||
})
|
})
|
||||||
setIsLoadMoreButtonVisible(hasMore)
|
setIsLoadMoreButtonVisible(hasMore)
|
||||||
setOffset(offset() + LOAD_MORE_PAGE_SIZE)
|
setOffset(offset() + LOAD_MORE_PAGE_SIZE)
|
||||||
|
result = newShouts
|
||||||
} else {
|
} else {
|
||||||
console.warn('[SaerchView] no query found')
|
console.warn('[SaerchView] no query found')
|
||||||
}
|
}
|
||||||
restoreScrollPosition()
|
restoreScrollPosition()
|
||||||
|
return result as LoadMoreItems
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -55,8 +60,8 @@ export const SearchView = (props: Props) => {
|
||||||
// TODO: use score from the search results to sort by relevance
|
// TODO: use score from the search results to sort by relevance
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="search-page wide-container">
|
<div class={clsx(styles.searchPage, 'wide-container')}>
|
||||||
<form action="/search" class="search-form row">
|
<form action="/search" class={clsx(styles.searchForm, 'row')}>
|
||||||
<div class="col-sm-18">
|
<div class="col-sm-18">
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
|
@ -93,8 +98,13 @@ export const SearchView = (props: Props) => {
|
||||||
<Show when={sortedFeed()?.length > 0}>
|
<Show when={sortedFeed()?.length > 0}>
|
||||||
<h3>{t('Publications')}</h3>
|
<h3>{t('Publications')}</h3>
|
||||||
|
|
||||||
<div class="floor">
|
<div class={clsx(stylesFeed.floor)}>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<LoadMoreWrapper
|
||||||
|
pageSize={SHOUTS_PER_PAGE}
|
||||||
|
hidden={!isLoadMoreButtonVisible()}
|
||||||
|
loadFunction={loadMore}
|
||||||
|
>
|
||||||
<For each={sortedFeed()}>
|
<For each={sortedFeed()}>
|
||||||
{(article) => (
|
{(article) => (
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -102,14 +112,7 @@ export const SearchView = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
</LoadMoreWrapper>
|
||||||
<Show when={isLoadMoreButtonVisible()}>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<a href={`/search/${query()}`} onClick={loadMore} class="search__show-more">
|
|
||||||
<span class="search__show-more-inner">{t('Load more')}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user