-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding page-content and heading components to styleguide components area
- Loading branch information
1 parent
ea52c58
commit 346a9b3
Showing
10 changed files
with
248 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{-- | ||
Label: "heading-1" | ||
Data: { | ||
"heading": "My heading" | ||
} | ||
--}} | ||
|
||
@foreach ($data as $item) | ||
<h2 class="mt-0 -mb-3" id="{{ Str::slug($item['heading']) }}">{{ $item['heading'] }}</h2> | ||
@endforeach |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
styleguide/Http/Controllers/ComponentsPageContentController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Styleguide\Http\Controllers; | ||
|
||
use Illuminate\View\View; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
class ComponentsPageContentController extends Controller | ||
{ | ||
/** | ||
* Display page content from a page field | ||
*/ | ||
public function index(Request $request): View | ||
{ | ||
$request->data['base']['page']['content']['main'] = ' | ||
<p style="margin-top: -1rem;">Move the CMS page content to the location of the <code>modular-page-content</code> page field.</p> | ||
'; | ||
|
||
$component_configuration = ' | ||
<table class="mt-2"> | ||
<thead> | ||
<tr> | ||
<th>Page field</th> | ||
<th>Data</th> | ||
</tr> | ||
</thead> | ||
<tr> | ||
<td> | ||
<pre class="w-full">modular-page-content</pre> | ||
</td> | ||
<td> | ||
<pre class="w-full" tabindex="0"> | ||
{} | ||
</pre> | ||
</td> | ||
</tr> | ||
</table> | ||
'; | ||
|
||
$components['components'] = [ | ||
'page-content' => [ | ||
'data' => [ | ||
0 => [ | ||
'filename' => 'page-content', | ||
], | ||
], | ||
'component' => [ | ||
'filename' => 'page-content', | ||
], | ||
], | ||
'accordion-1' => [ | ||
'data' => [ | ||
0 => [ | ||
'title' => 'Component configuration', | ||
'promo_item_id' => 'componentConfiguration', | ||
'description' => $component_configuration, | ||
], | ||
], | ||
'component' => [ | ||
'filename' => 'accordion', | ||
], | ||
], | ||
]; | ||
|
||
return view('childpage', merge($request->data, $components)); | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
styleguide/Http/Controllers/HeadingComponentController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
namespace Styleguide\Http\Controllers; | ||
|
||
use Illuminate\View\View; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use Factories\GenericPromo; | ||
use Factories\Event; | ||
|
||
class HeadingComponentController extends Controller | ||
{ | ||
/** | ||
* Display a page heading from a page field | ||
*/ | ||
public function index(Request $request): View | ||
{ | ||
$request->data['base']['page']['content']['main'] = ' | ||
<p>Add a page heading that spans an entire row. Suggested to use over two related columns, like an "Events" heading over a promo-column featured image, and an events-column. You would not use this when you can add a heading to an individual component.</p> | ||
'; | ||
|
||
$component_configuration = ' | ||
<table class="mt-2"> | ||
<thead> | ||
<tr> | ||
<th>Page field</th> | ||
<th>Data</th> | ||
</tr> | ||
</thead> | ||
<tr> | ||
<td> | ||
<pre class="w-full">modular-heading</pre> | ||
</td> | ||
<td> | ||
<pre class="w-full" tabindex="0"> | ||
{ | ||
"heading": "My heading" | ||
} | ||
</pre> | ||
</td> | ||
</tr> | ||
</table> | ||
'; | ||
|
||
$components['components'] = [ | ||
'accordion-1' => [ | ||
'data' => [ | ||
0 => [ | ||
'title' => 'Component configuration', | ||
'promo_item_id' => 'componentConfiguration', | ||
'description' => $component_configuration, | ||
], | ||
], | ||
'component' => [ | ||
'filename' => 'accordion', | ||
], | ||
], | ||
'heading-1' => [ | ||
'data' => [ | ||
0 => [ | ||
'heading' => 'My example heading', | ||
], | ||
], | ||
'component' => [ | ||
'filename' => 'heading', | ||
], | ||
], | ||
'events-column' => [ | ||
'data' => app(Event::class)->create(4, false), | ||
'component' => [ | ||
'filename' => 'events-column', | ||
'calendar_url' => '/myurl' | ||
], | ||
], | ||
'promo-column-2' => [ | ||
'data' => app(GenericPromo::class)->create(1, false, [ | ||
'title' => 'Featured event (promo column)', | ||
'filename_url' => '/styleguide/image/600x600', | ||
'description' => '', | ||
]), | ||
'component' => [ | ||
'heading' => '', | ||
'filename' => 'promo-column', | ||
'gradientOverlay' => true, | ||
], | ||
], | ||
]; | ||
|
||
return view('childpage', merge($request->data, $components)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Styleguide\Pages; | ||
|
||
use Factories\Page as PageFactory; | ||
|
||
class ComponentsPageContent extends Page | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPageData() | ||
{ | ||
return app(PageFactory::class)->create(1, true, [ | ||
'page' => [ | ||
'controller' => 'ComponentsPageContentController', | ||
'title' => 'Page content', | ||
'id' => 123100, | ||
'content' => [ | ||
'main' => '', | ||
], | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Styleguide\Pages; | ||
|
||
use Factories\Page as PageFactory; | ||
|
||
class HeadingComponent extends Page | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPageData() | ||
{ | ||
return app(PageFactory::class)->create(1, true, [ | ||
'page' => [ | ||
'controller' => 'HeadingComponentController', | ||
'title' => 'Heading', | ||
'id' => 122100, | ||
'content' => [ | ||
'main' => '', | ||
], | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters