Skip to main content

General

Article Body code

Copy the implementation or inspect every file that belongs to this component unit.

resources/views/components/ui/article-body.blade.php

@props([
    'content',
])

@php
    /*
    | Renders plain-text article content as spaced paragraphs.
    |
    | Usage:
    |   <x-ui.article-body :content="$post->body" />
    */
@endphp

<div {{ $attributes->merge(['class' => 'space-y-6 text-lg leading-relaxed text-gray-700 dark:text-gray-300']) }}>
    @foreach (preg_split('/\n{2,}/', trim($content)) as $paragraph)
        <p class="whitespace-pre-line">{{ $paragraph }}</p>
    @endforeach
</div>