Skip to content

Commit 8f1aa66

Browse files
feat(comparisons): refine structured article comparison layouts
Give comparison articles clearer side identities and responsive layouts. Render backticked article text as inline code. Co-Authored-By: Hagicode <noreply@hagicode.com> Signed-off-by: newbe36524 <newbe36524@hotmail.com>
1 parent 507ec21 commit 8f1aa66

7 files changed

Lines changed: 574 additions & 79 deletions

‎src/components/InlineText.astro‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
// Plain text with `backtick` segments rendered as <code>. Renders inline, no wrapper element.
3+
import { splitInlineCode } from '@/lib/comparison-layout.mjs';
4+
5+
const { text = '' } = Astro.props;
6+
const segments = splitInlineCode(text);
7+
---
8+
9+
{segments.map((segment) => (segment.code ? <code class="inline-code">{segment.text}</code> : segment.text))}
10+
11+
<style is:global>
12+
/* Global on purpose: this component is used from several article components that all share the one look. */
13+
.inline-code {
14+
padding: 0.08em 0.38em;
15+
border: 1px solid var(--sl-color-gray-5);
16+
border-radius: 0.3rem;
17+
background: var(--sl-color-bg-inline-code, var(--sl-color-gray-6));
18+
font-family: var(--sl-font-mono);
19+
font-size: 0.88em;
20+
line-height: 1.2;
21+
overflow-wrap: anywhere;
22+
}
23+
</style>

0 commit comments

Comments
 (0)