2022-10-31 16:40:55 +00:00
|
|
|
import { createComputed, createSignal, Show, For } from 'solid-js'
|
2022-09-09 11:53:35 +00:00
|
|
|
import type { Shout } from '../../graphql/types.gen'
|
|
|
|
import { ArticleCard } from './Card'
|
2022-10-28 21:21:47 +00:00
|
|
|
|
2022-09-09 11:53:35 +00:00
|
|
|
const x = [
|
|
|
|
['6', '6'],
|
|
|
|
['4', '8'],
|
|
|
|
['8', '4']
|
|
|
|
]
|
|
|
|
|
2023-01-24 22:15:29 +00:00
|
|
|
export const Row2 = (props: { articles: Shout[]; isEqual?: boolean; nodate?: boolean }) => {
|
2022-09-09 11:53:35 +00:00
|
|
|
const [y, setY] = createSignal(0)
|
|
|
|
|
|
|
|
createComputed(() => setY(Math.floor(Math.random() * x.length)))
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div class="floor">
|
2022-11-20 21:23:12 +00:00
|
|
|
<div class="wide-container">
|
|
|
|
<div class="row">
|
|
|
|
<For each={props.articles}>
|
|
|
|
{(a, i) => {
|
|
|
|
return (
|
|
|
|
<Show when={!!a}>
|
|
|
|
<div class={`col-md-${props.isEqual ? '6' : x[y()][i()]}`}>
|
|
|
|
<ArticleCard
|
|
|
|
article={a}
|
|
|
|
settings={{
|
|
|
|
isWithCover: props.isEqual || x[y()][i()] === '8',
|
2023-01-24 22:15:29 +00:00
|
|
|
nodate: props.isEqual || props.nodate
|
2022-11-20 21:23:12 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Show>
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
</For>
|
|
|
|
</div>
|
2022-09-09 11:53:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|