Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/accordion upgrade #712

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion factories/AccordionItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,18 @@ public function create($limit = 1, $flatten = false, $options = [])
for ($i = 1; $i <= $limit; $i++) {
$data[$i] = [
'title' => $this->faker->sentence(),
'description' => '<p>'.$this->faker->paragraph().' <a href="/styleguide">Example link.</a></p>',
'description' => '<p>'.$this->faker->paragraph(5).' <a href="#">Example link.</a><ul><li>'.$this->faker->sentence.'</li><li>'.$this->faker->sentence.'</li><li>'.$this->faker->sentence.'</li></ul></p>',
'promo_item_id' => $this->faker->numberBetween(1000, 10000),
'relative_url' => $this->faker->randomElement([
'/styleguide/image/600x450?text=600x450', // 4:3
'/styleguide/image/450x600?text=450x600', // 3:4
'/styleguide/image/600x338?text=600x338', // 16:9
'/styleguide/image/600x600?text=600x600', // 1:1
'',
]),
'filename_alt_text' => 'Placeholder image '.$i,
'option' => $this->faker->randomElement(['Left','Right','Center','']),
'excerpt' => $this->faker->sentence,
];

$data[$i] = array_replace_recursive($data[$i], $options);
Expand Down
5 changes: 1 addition & 4 deletions resources/scss/components/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ figure {
}

figcaption {
@apply text-sm text-gray-500 text-left;

display: table-caption;
caption-side: bottom;
@apply text-sm text-green italic text-left mt-1 table-caption caption-bottom;
}

@screen mt {
Expand Down
13 changes: 12 additions & 1 deletion resources/views/components/accordion.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@
@foreach($data as $item)
<li>
<a href="#definition-{{ $item['promo_item_id'] }}" id="definition-{{ $item['promo_item_id'] }}"><span aria-hidden="true"></span>{{ $item['title'] }}</a>
<div class="content">{!! $item['description'] !!}</div>
<div class="content">
<div class="flex gap-6 items-center flex-col {{ !empty($item['option']) && ($item['option'] === 'Left' || $item['option'] === 'Center') ? (($item['option'] === 'Center') ? '' : 'mt:flex-row-reverse mt:items-start') : 'mt:items-start mt:flex-row'}}">
<div class="w-full">{!! $item['description'] !!}</div>

@if(!empty($item['relative_url']))
<figure class="m-0 w-2/3 shrink-0 {{ !empty($item['option']) && $item['option'] === 'Center' ? '' : 'mt:w-2/5' }}">
<img src="{{ $item['relative_url'] }}" alt="{{ $item['filename_alt_text'] }}">
@if(!empty($item['excerpt']))<figcaption>{{ $item['excerpt'] }}</figcaption>@endif
</figure>
@endif
</div>
</div>
</li>
@endforeach
</ul>
2 changes: 1 addition & 1 deletion resources/views/layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">

@if(!empty($base['page']['canonical']))<link rel="canonical" href="{{ $base['page']['canonical'] }}">@endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function index(Request $request): View
'table' => [
'Title' => 'Text on closed accordion',
'Description' => 'Content when the accordion is clicked open',
'Filename' => 'Optional image, variable size',
'Primary image' => 'Optional image',
'Excerpt' => 'Image caption',
'Option' => 'Image orientation: Right, Left, Center',
'Option' => 'Image orientation: Left, Center, Right(default)',
],
],
],
Expand Down
Loading