kana/main.js

30 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-05-16 23:53:51 +08:00
import { div, span, main, section, aside, h3, p, ul, li } from '@laniakeasupercluster/widgets'
2024-05-16 20:53:13 +08:00
const blogData = [
{ id: '1', title: 'Blog 1', content: 'Content 1', date: new Date() },
{ id: '2', title: 'Blog 2', content: 'Content 2', date: new Date() },
{ id: '3', title: 'Blog 3', content: 'Content 3', date: new Date() },
]
2024-05-16 23:53:51 +08:00
const tagData = ['JavaScript', 'CSS', 'HTML', 'Web', 'JavaScript', 'CSS', 'HTML', 'Web', 'JavaScript', 'CSS', 'HTML', 'Web', 'JavaScript', 'CSS', 'HTML', 'Web']
2024-05-16 20:53:13 +08:00
const articleData = ['Article 1', 'Article 2', 'Article 3']
document.body.appendChild(div.grid({ gridTemplateColumns: '3fr 1fr', gap: '1rem' }).p('1rem').childs([
main.grid({ gap: '1rem' }).childs(blogData.map(blog => section.childs([
h3.text(blog.title),
p.text(blog.content),
p.text(blog.date),
]))),
aside.grid({ gridColumn: '2', flexDirection: 'column', gap: '1rem' }).childs([
div.childs([
h3.text('# TAG'),
2024-05-16 23:53:51 +08:00
div.flex({ gap: '.5rem', flexWrap: 'wrap' }).childs([
...tagData.map(tag => span.bg('#ececec').radius('.25rem').px('8px').text(tag))
]),
2024-05-16 20:53:13 +08:00
]),
div.childs([
h3.text('# 归档'),
ul.childs(articleData.map(article => li.text(article))),
]),
]),
]))