Skip to content

Commit

Permalink
Dynamically set Tailwind blockquote colors in Blade
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 6, 2024
1 parent fcf5efa commit a99ee0a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<blockquote class="{{ $class }}">
<blockquote @class([
'border-blue-500' => $class === 'info',
'border-green-500' => $class === 'success',
'border-amber-500' => $class === 'warning',
'border-red-600' => $class === 'danger',
])>
{!! $contents !!}
</blockquote>
2 changes: 1 addition & 1 deletion packages/framework/tests/Feature/IncludesFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function testAdvancedMarkdownDocumentIsCompiledToHtml()
$expected = <<<'HTML'
<h1>Heading</h1>
<p>This is a paragraph. It has some <strong>bold</strong> and <em>italic</em> text.</p>
<blockquote class="info">
<blockquote class="border-blue-500">
<p>Info Blockquote</p>
</blockquote>
<pre><code class="language-php"><small class="relative float-right opacity-50 hover:opacity-100 transition-opacity duration-250 not-prose hidden md:block top-0 right-0"><span class="sr-only">Filepath: </span>hello.php</small>echo 'Hello, World!';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testDiscoveredShortcodesAreUsedToProcessInput()
$processor = new ShortcodeProcessor('>info foo');

$this->assertSame(<<<'HTML'
<blockquote class="info">
<blockquote class="border-blue-500">
<p>foo</p>
</blockquote>
HTML, $processor->run());
Expand All @@ -55,7 +55,7 @@ public function testProcessStaticShorthand()
{
$this->assertSame(
<<<'HTML'
<blockquote class="info">
<blockquote class="border-blue-500">
<p>foo</p>
</blockquote>
HTML, ShortcodeProcessor::preprocess('>info foo')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testSignatures()
public function testResolveMethod()
{
$this->assertSame(<<<'HTML'
<blockquote class="info">
<blockquote class="border-blue-500">
<p>foo</p>
</blockquote>
HTML, ColoredBlockquotes::resolve('>info foo')
Expand All @@ -51,7 +51,7 @@ public function testCanUseMarkdownWithinBlockquote()
{
$this->assertSame(
<<<'HTML'
<blockquote class="info">
<blockquote class="border-blue-500">
<p>foo <strong>bar</strong></p>
</blockquote>
HTML, ColoredBlockquotes::resolve('>info foo **bar**')
Expand Down Expand Up @@ -80,31 +80,31 @@ public static function blockquoteProvider(): array
[
'>danger This is a danger blockquote',
<<<'HTML'
<blockquote class="danger">
<blockquote class="border-red-600">
<p>This is a danger blockquote</p>
</blockquote>
HTML,
],
[
'>info This is an info blockquote',
<<<'HTML'
<blockquote class="info">
<blockquote class="border-blue-500">
<p>This is an info blockquote</p>
</blockquote>
HTML,
],
[
'>success This is a success blockquote',
<<<'HTML'
<blockquote class="success">
<blockquote class="border-green-500">
<p>This is a success blockquote</p>
</blockquote>
HTML,
],
[
'>warning This is a warning blockquote',
<<<'HTML'
<blockquote class="warning">
<blockquote class="border-amber-500">
<p>This is a warning blockquote</p>
</blockquote>
HTML,
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/MarkdownHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function testRenderWithCustomHydeMarkdownFeatures()

$this->assertSame(<<<'HTML'
<h1>Hello World</h1>
<blockquote class="info">
<blockquote class="border-blue-500">
<p>Colored blockquote</p>
</blockquote>
<p><a href="index.html">Home</a></p>
Expand Down
15 changes: 0 additions & 15 deletions packages/hydefront/components/blockquotes.css

This file was deleted.

1 change: 0 additions & 1 deletion resources/assets/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

@import 'hydefront/components/torchlight.css';
@import 'hydefront/components/blockquotes.css';

@tailwind base;
@tailwind components;
Expand Down

0 comments on commit a99ee0a

Please sign in to comment.