Skip to content

Commit

Permalink
Replace theme variables with CSS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Sep 12, 2024
1 parent dab90d8 commit 7a47431
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 26 deletions.
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Changelog

1.10.7 (Unreleased)
-----------------------
Enh #342: JS Dependency Updates
- Enh #342: JS Dependency Updates
- Enh #344: Replace theme variables with CSS variables

1.10.6 (August 6, 2024)
-----------------------
Expand Down
6 changes: 3 additions & 3 deletions modules/template/widgets/views/templatePageEditButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
</div>

<?php else: ?>
<a id="editPageButton" class="btn btn-primary btn-xs" data-ui-loader style="color:#000;" href="<?= Url::to(['view', 'id' => $pageId, 'editMode' => true, 'sguid' => $sguid]); ?>">
<i class="fa fa-pencil"></i>
<a id="editPageButton" class="btn btn-primary btn-xs" data-ui-loader style="color:var(--text-color-highlight)" href="<?= Url::to(['view', 'id' => $pageId, 'editMode' => true, 'sguid' => $sguid]); ?>">
<i class="fa fa-pencil"></i>
<?= Yii::t('CustomPagesModule.modules_template_widgets_views_templatePageEditButton', 'Edit Page') ?>
</a>
<?php endif; ?>
<?php endif; ?>
2 changes: 1 addition & 1 deletion views/container/markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$cssClass = ($page->hasAttribute('cssClass') && !empty($page->cssClass)) ? $page->cssClass : 'custom-pages-page';
?>

<?= CustomPageInlineStyle::widget(['theme' => $this->theme]); ?>
<?= CustomPageInlineStyle::widget() ?>

<?= PageConfigurationButton::widget() ?>
<div class="panel panel-default <?= Html::encode($cssClass) ?>">
Expand Down
2 changes: 1 addition & 1 deletion views/global/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$cssClass = ($page->hasAttribute('cssClass') && !empty($page->cssClass)) ? $page->cssClass : 'custom-pages-page';
?>

<?= CustomPageInlineStyle::widget(['theme' => $this->theme]); ?>
<?= CustomPageInlineStyle::widget() ?>

<div class="container <?= Html::encode($cssClass) ?>">
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion views/global/markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$cssClass = ($page->hasAttribute('cssClass') && !empty($page->cssClass)) ? $page->cssClass : 'custom-pages-page';
?>

<?= CustomPageInlineStyle::widget(['theme' => $this->theme]); ?>
<?= CustomPageInlineStyle::widget() ?>

<?php if ($page->hasTarget(Page::NAV_CLASS_ACCOUNTNAV)): ?>
<div class="panel panel-default <?= Html::encode($cssClass) ?>">
Expand Down
12 changes: 1 addition & 11 deletions widgets/CustomPageInlineStyle.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
<?php


namespace humhub\modules\custom_pages\widgets;

use humhub\components\Widget;
use humhub\modules\ui\view\components\Theme;

/**
* Class CustomPageInlineStyle for custom pages inline styling
* @package modules\custom_pages\widgets
*/
class CustomPageInlineStyle extends Widget
{
/**
* @var Theme
*/
public $theme;

public function run()
{
$linkColor = $this->theme->variable('link', $this->theme->variable('info'));
return $this->render('inline-style', [
'linkColor' => $linkColor,
]);
return $this->render('inline-style');
}

}
10 changes: 2 additions & 8 deletions widgets/views/inline-style.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<?php
/* @var $linkColor string */
?>

<style>
.custom-pages-page a, .panel .panel-body p a {
color: <?= $linkColor ?>;
color: var(--link);
}

.custom-pages-page a:hover, .panel .panel-body p a:hover {
color: <?= $linkColor ?>;
color: var(--link);
text-decoration: underline;
}
</style>

0 comments on commit 7a47431

Please sign in to comment.