Skip to content

Commit

Permalink
IsSourced: Wrap hook status icons in single span & reduce spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
jon48 committed Jul 25, 2022
1 parent b5594ef commit adeda5f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use MyArtJaub\Webtrees\Module\IsSourced\Services\SourceStatusService;
use Fisharebest\Webtrees\Individual;

/**
* @var string $module_name
* @var SourceStatusService $source_status_service
* @var Individual $individual
* @var string $size_style
*/

?>
<span class="maj-issourced-hook-name-append align-middle d-inline-flex align-items-stretch justify-content-between">
<?= view($module_name . '::icons/source-status', [
'module_name' => $module_name,
'source_status' => $source_status_service->sourceStatusForRecord($individual),
'context' => 'INDI',
'size_style' => $size_style ]) ?>
<?= view($module_name . '::icons/source-status', [
'module_name' => $module_name,
'source_status' => $source_status_service->sourceStatusForBirth($individual),
'context' => 'INDI:BIRT',
'size_style' => $size_style ]) ?>
<?php if ($individual->isDead()) : ?>
<?= view($module_name . '::icons/source-status', [
'module_name' => $module_name,
'source_status' => $source_status_service->sourceStatusForDeath($individual),
'context' => 'INDI:DEAT',
'size_style' => $size_style ]) ?>
<?php endif; ?>
</span>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ $css_class .= $source_status->factHasDate() ? '-fd' : '';
$css_class .= $source_status->factHasPreciseDate() ? '-fpd' : '';
$css_class .= $source_status->sourceMatchesFactDate() ? '-smd' : '';

$size_style .= ($source_status->factHasPreciseDate() &&
($source_status->hasSupportingDocument() || $source_status->sourceMatchesFactDate() || !$source_status->hasSource())) ? ' maj-icon-sourcestatus-mx' : '';
$size_style .= ($source_status->hasSupportingDocument() || $source_status->sourceMatchesFactDate()) ? ' fa-fw' : '';

?>

<span class="maj-icon-sourcestatus <?= $css_class ?> fa-layers fa-fw <?= $size_style ?>" aria-hidden="true" title="<?= $source_status->label($context) ?>">
<span class="maj-icon-sourcestatus <?= $css_class ?> fa-layers <?= $size_style ?>" aria-hidden="true" title="<?= $source_status->label($context) ?>">
<?php if ($source_status->factHasPreciseDate()) : ?>
<?php if ($source_status->hasSource()) : ?>
<?php if ($source_status->hasSupportingDocument()) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ use MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus;
* @var string $css_class
* @var string $context
*/

$size_style .= ($source_status->hasSupportingDocument() || !$source_status->hasSource()) ? ' maj-icon-sourcestatus-mx' : '';
$size_style .= $source_status->hasSupportingDocument() ? ' fa-fw' : '';

?>

<span class="maj-icon-sourcestatus <?= $css_class ?> fa-layers fa-fw <?= $size_style ?>" aria-hidden="true" title="<?= $source_status->label($context) ?>">
<span class="maj-icon-sourcestatus <?= $css_class ?> fa-layers <?= $size_style ?>" aria-hidden="true" title="<?= $source_status->label($context) ?>">
<?php if ($source_status->hasSupportingDocument()) : ?>
<i class="fa-solid fa-scroll" data-fa-transform="flip-h right-2"></i>
<?php endif; ?>
Expand Down
5 changes: 4 additions & 1 deletion modules_v4/myartjaub_issourced/src/sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
}

.maj-icon-sourcestatus {
vertical-align: middle;
&-mx {
margin-left: 0.15em;
margin-right: 0.15em;
}

.fa-scroll {
color: #c9b88c;
Expand Down

0 comments on commit adeda5f

Please sign in to comment.