import { Row1 } from './Row1'
import { Row2 } from './Row2'
import { Row3 } from './Row3'
import { shuffle } from '../../utils'
import { createMemo, createSignal, For, Suspense } from 'solid-js'
import type { JSX } from 'solid-js'
import type { Shout } from '../../graphql/types.gen'
import './List.scss'
import { t } from '../../utils/intl'
export const Block6 = (props: { articles: Shout[] }) => {
const dice = createMemo(() => shuffle([Row1, Row2, Row3]))
return (
<>
{(c: (ppp: Shout[]) => JSX.Element) => c(props.articles)}
>
)
}
interface ArticleListProps {
articles: Shout[]
page: number
size: number
}
export default (props: ArticleListProps) => {
const [articles, setArticles] = createSignal(
props.articles.slice(props.page * props.size, props.size * (props.page + 1)) || []
)
const [loadingMore, setLoadingMore] = createSignal(false)
// const [, { more }] = useZine()
const handleMore = () => {
setArticles(props.articles.slice(props.page * props.size, props.size * (props.page + 1)))
if (props.size * (props.page + 1) > props.articles.length) {
console.log('[article-list] load more')
setLoadingMore(true)
// TODO: more()
setLoadingMore(false)
}
}
return (
{t('Loading')}}>
{() => }
{loadingMore() ? '...' : t('More')}
)
}