diff --git a/components/BlogBlocks.css b/components/BlogBlocks.css new file mode 100644 index 0000000..f4455e7 --- /dev/null +++ b/components/BlogBlocks.css @@ -0,0 +1,164 @@ +.components__blog_block { + min-width: 10rem; + aspect-ratio: 3 / 4; + display: flex; + flex-direction: column; + box-shadow: 0 0 0.4rem 0.2rem var(--_translucent); + border: var(--_border-size) solid transparent; + background-repeat: no-repeat; + background-size: 80%; + background-position: center var(--_gap); + backdrop-filter: blur(var(--_blur)); + background-color: var(--_background-color); + + &:has(a:focus-visible), + &:hover { + border: var(--_border-size) solid var(--_accent-color); + } + + & h3 { + margin: 0; + padding: var(--_gap) var(--_gap-half); + backdrop-filter: blur(var(--_blur)); + background-color: var(--_translucent); + border-bottom: 1px solid currentColor; + } + + & a { + outline: none; + } +} + +.components__blog_block--card { + max-width: 20rem; +} + +.components__blog_block--placeholder { + animation: var(--animation-blink); +} + +.components__blog_block--fallback { + opacity: 0.5; +} + +:is(.components__blog_block--placeholder, .components__blog_block--fallback) { + h3 { + flex-grow: 1; + border: none; + align-content: center; + text-align: center; + } +} + +.components__blog_block__spacer { + height: 0; +} + +.components__blog_block--card .components__blog_block__spacer { + height: 30%; +} + +.components__blog_block__links { + height: fit-content; + display: flex; + gap: var(--_gap-half); + justify-content: start; + padding: var(--_gap-half); + backdrop-filter: blur(var(--_blur)); + background-color: var(--_translucent); + border-bottom: 1px solid currentColor; + + & > a::before { + content: 'đź”—'; + } +} + +.components__blog_block__tags { + height: fit-content; + display: flex; + gap: var(--_gap-half); + justify-content: start; + padding: var(--_gap-half); + backdrop-filter: blur(var(--_blur)); + background-color: var(--_translucent); + border-bottom: 1px solid currentColor; + + & > span::before { + content: '#'; + } +} + +.components__blog_block__status { + display: block; + padding: var(--_gap-half); + background-color: var(--_translucent); + backdrop-filter: blur(var(--_blur)); +} + +.components__blog_block--card .components__blog_block__status { + position: absolute; + top: var(--_gap-half); + left: var(--_gap-half); + font-size: larger; +} + +.components__blog_block__publisher { + display: block; + padding: var(--_gap-half); + background-color: var(--_translucent); + backdrop-filter: blur(var(--_blur)); +} + +.components__blog_block--card .components__blog_block__publisher { + position: absolute; + top: var(--_gap-half); + right: var(--_gap-half); +} + +.components__blog_block__description { + text-wrap: balance; + flex-grow: 1; + backdrop-filter: blur(var(--_blur)); + padding: var(--_gap-half); +} + +.components__blog_block--card .components__blog_block__description { + min-height: 25%; +} + +.components__blog_block__body { + text-wrap: balance; + flex-grow: 1; + padding: var(--_gap-half); +} + +.components__blog_block__footer { + height: fit-content; + display: flex; + gap: var(--_gap); + justify-content: space-between; + padding: var(--_gap-half); + background-color: var(--_background-color); +} + +.components__blog_post__infos { + display: flex; + gap: var(--_gap-half); + margin-block: var(--_gap-half); + + & > * { + border: none; + padding: var(--_gap-half); + background-color: var(--_translucent); + } +} + +.components__blog_post__description { + margin-block: var(--_gap-half); + font-family: var(--_font-family-code); +} + +.components__blog_block--post { + width: var(--_readable-screen); + margin-inline: auto; +} diff --git a/components/BlogBlocks.tsx b/components/BlogBlocks.tsx new file mode 100644 index 0000000..9199c7e --- /dev/null +++ b/components/BlogBlocks.tsx @@ -0,0 +1,157 @@ +import { Markdown } from ':components/Markdown.tsx' +import { NewsFrontMatter } from ':src/blog/types.ts' + +export type BlogProps = { + title: string + description: string + body: string + author: string + publisher: string + lastUpdate: Date + name: string + url: string + hash: string + options: NewsFrontMatter['x-cohabit'] + tags: NewsFrontMatter['tags'] +} + +export function BlogCard( + { title, description, author, lastUpdate, name, options, tags, publisher }: + BlogProps, +) { + return ( +
+ ) +} + +export function BlogPost( + { + title, + description, + author, + lastUpdate, + body, + url, + options, + tags, + publisher, + }: BlogProps, +) { + return ( +