Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
[Hotfix] Add description below to indicator widget (#39)
Browse files Browse the repository at this point in the history
* Add description

* add new line

Co-authored-by: Khadija Mahanga <[email protected]>
  • Loading branch information
karimkawambwa and KhadijaMahanga authored Jan 15, 2020
1 parent 8cb3c80 commit 9489e36
Showing 1 changed file with 103 additions and 81 deletions.
184 changes: 103 additions & 81 deletions wp-content/themes/hurumap/template-parts/blocks/indicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,85 +37,107 @@

$layout = $this_widget['acf_fc_layout']
?>
<div id="<?php echo esc_attr($id); ?>" data-title="<?php echo $title; ?>" data-description="<?php echo $description; ?>" data-source-title="<?php echo $source_title; ?>" data-source-link="<?php echo $source_link; ?>" data-src="<?php echo esc_attr(array_values($this_widget)[1]); ?>" data-layout="<?php echo $layout; ?>" class="<?php echo esc_attr($className); ?>">

<div class="indicator-header">
<p class="indicator-title"><?php echo $title; ?></p>
<span class="indicator-subtitle"><?php echo $subtitle; ?></span>
<span class="indicator-subtitle"><?php echo $description; ?></span>

</div>
<div class="indicator-div">
<?php switch ($layout) {

//echo for raw html
case 'raw_html_widget':
echo $this_widget['raw_html'];
break;
//use wp get attachment for image
case 'image_widget':
echo wp_get_attachment_image($this_widget['image_content'], 'full');
break;

//use document viewer
case 'document_widget':
$doc_div = "<div class='document-root'>
<div class='paginate-button'><button id='prev'><span class='dashicons dashicons-arrow-left-alt2 icon'></span></button></div>
<div class='canvas-div'><canvas id='the-canvas' data-src='" . $this_widget['document_content'] . "' width='100%'></canvas></div>
<div class='paginate-button right' ><button id='next'><span class='dashicons dashicons-arrow-right-alt2 icon'></span></button></div></div>";
echo $doc_div;
break;

//free_form
case 'free_form_widget':
echo $widget[0]['body'];
break;

case 'embed_widget':
$embed = "<iframe src='" . $this_widget['embed_content'] . "'></iframe>";
echo $embed;
break;
default:
break;
}
?>
<div>
<div id="<?php echo esc_attr($id); ?>" data-title="<?php echo $title; ?>" data-description="<?php echo $description; ?>" data-source-title="<?php echo $source_title; ?>" data-source-link="<?php echo $source_link; ?>" data-src="<?php echo esc_attr(array_values($this_widget)[1]); ?>" data-layout="<?php echo $layout; ?>" class="<?php echo esc_attr($className); ?>">

<div class="indicator-header">
<p class="indicator-title"><?php echo $title; ?></p>
<span class="indicator-subtitle"><?php echo $subtitle; ?></span>
</div>
<div class="indicator-div">
<?php switch ($layout) {

//echo for raw html
case 'raw_html_widget':
echo $this_widget['raw_html'];
break;
//use wp get attachment for image
case 'image_widget':
echo wp_get_attachment_image($this_widget['image_content'], 'full');
break;

//use document viewer
case 'document_widget':
$doc_div = "<div class='document-root'>
<div class='paginate-button'><button id='prev'><span class='dashicons dashicons-arrow-left-alt2 icon'></span></button></div>
<div class='canvas-div'><canvas id='the-canvas' data-src='" . $this_widget['document_content'] . "' width='100%'></canvas></div>
<div class='paginate-button right' ><button id='next'><span class='dashicons dashicons-arrow-right-alt2 icon'></span></button></div></div>";
echo $doc_div;
break;

//free_form
case 'free_form_widget':
echo $widget[0]['body'];
break;

case 'embed_widget':
$embed = "<iframe src='" . $this_widget['embed_content'] . "'></iframe>";
echo $embed;
break;
default:
break;
}
?>
</div>
<div class="indicator-footer">
<span class="indicator-source"><a href="<?php echo esc_attr($source_link); ?>"><?php echo $source_title; ?></a></span>
</div>
<style type="text/css">
<?php echo "#" . $id; ?> {
background: <?php echo $background_color; ?>;
color: <?php echo $text_color; ?>;
}

.indicator-widget {
padding: 1.25rem;
}

.indicator-title {
font-weight: bold;
text-align: center;
}

.document-root {
display: flex;
}

.paginate-button {
align-self: center;
width: 12%;
}

.canvas-div {
width: 76%;
display: flex;
justify-content: center;
}

button {
background: none;
border: none;
}

.icon {
font-size: 3.75rem;
}

.indicator-decription {
display: flex;
align-items: center;
padding: 0 5%;
margin-top: 1.25rem;
}

.indicator-description-text {
margin-left: 1.25rem;
}
</style>
</div>
<div class="indicator-footer">
<span class="indicator-source"><a href="<?php echo esc_attr($source_link); ?>"><?php echo $source_title; ?></a></span>
</div>
<style type="text/css">
<?php echo "#" . $id; ?> {
background: <?php echo $background_color; ?>;
color: <?php echo $text_color; ?>;
}

.indicator-title {
font-weight: bold;
text-align: center;
}

.document-root {
display: flex;
}

.paginate-button {
align-self: center;
width: 12%;
}

.canvas-div {
width: 76%;
display: flex;
justify-content: center;
}

button {
background: none;
border: none;
}

.icon {
font-size: 60px;
}
</style>
</div>

<?php if ($description) { ?>
<div class="indicator-decription">
<svg class="MuiSvgIcon-root MuiSvgIcon-colorPrimary" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation"><path d="M7 14l5-5 5 5z"></path></svg>
<span class="indicator-description-text"><?php echo $description; ?></span>
</div>
<?php } ?>
</div>

0 comments on commit 9489e36

Please sign in to comment.