Skip to content

Commit

Permalink
style: update (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliwenwenwen authored Nov 25, 2024
1 parent 7aac882 commit d7e25e0
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 5 deletions.
19 changes: 19 additions & 0 deletions pingcap-jp/acf/acf-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,25 @@
'readonly' => 0,
'disabled' => 0,
),
array(
'key' => 'field_' . $acf_group . '_side_image_align_center',
'label' => 'Center the image inside the container',
'name' => $acf_group . '_side_image_align_center',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'message' => '',
'ui' => 1,
'ui_on_text' => 'Yes',
'ui_off_text' => 'No',
'default_value' => 0,
),

/**
* Tab: Side Form
Expand Down
1 change: 0 additions & 1 deletion pingcap-jp/css/blocks/icon-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
}

&__item {
text-align: center;
h5 {
color: var(--color-blue-dark);
}
Expand Down
5 changes: 5 additions & 0 deletions pingcap-jp/css/components/banners/banner-default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@
@include media-min($large) {
right: -62px;
}
&--center {
@include media-min($large) {
right: 62PX;
}
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions pingcap-jp/css/templates/summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@
color: #000;
width: max-content;
}
.tip{
color: #fff;
margin-top: 16px;
}
}
&__carousel {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion pingcap-jp/grav-blocks/case/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<?php Images::safe_image_output($image); ?>
<div class="case-card__title"><?php echo $title; ?></div>
<p><?php echo $desc; ?></p>
<span class="button-link">Read More<i class="button__arrow"></i></span>
<span class="button-link">詳細を見る<i class="button__arrow"></i></span>
</a>
</div>
<?php } ?>
Expand Down
22 changes: 22 additions & 0 deletions pingcap-jp/inc/PingCAP/Components/Banners/BannerDefault.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ class BannerDefault implements IComponent
*/
public bool $side_image_pull_up = false;

/**
* Flag indicating that the side image should be center
* on large displays
*
* @var boolean
*/
public bool $side_image_align_center = false;

/**
* Flag indicating that the side image should cover the entire image container
*
Expand Down Expand Up @@ -445,6 +453,16 @@ public function __construct(array $params)
]
)
);

$this->side_image_align_center = Arrays::get_value_as_bool(
$params,
'side_image_align_center',
fn() => ACF::get_field_bool(
$this->acf_prefix . '_side_image_align_center',
$this->post_id,
['default' => false]
)
);
}

$this->side_video_bg = Arrays::get_value_as_bool(
Expand Down Expand Up @@ -779,6 +797,10 @@ public function render(): void
$image_container_classes[] = 'banner-default__image-container--pull-up';
}

if($this->side_image_align_center) {
$image_container_classes[] = 'banner-default__image-container--center';
}

?>
<div class="<?php echo esc_attr(implode(' ', $image_container_classes)); ?>">
<?php
Expand Down
4 changes: 2 additions & 2 deletions pingcap-jp/inc/PingCAP/Components/HeaderSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function render(): void
</div>
</div>
</div>
<a class="button" href="/tidb-user-day/jul-2024/">アーカイブ動画を視聴する</a>
<a class="button" href="/tidb-user-day/jul-2024/">TiUD2024アーカイブ動画を見る</a>
</nav>
<div class="navbar-toggle">
<span></span>
Expand Down Expand Up @@ -76,7 +76,7 @@ public function render(): void
</div>
</div>
</div>
<a class="button" href="/tidb-user-day/jul-2024/">アーカイブ動画を視聴する</a>
<a class="button" href="/tidb-user-day/jul-2024/">TiUD2024アーカイブ動画を見る</a>
</nav>
</header>
<?php
Expand Down
15 changes: 15 additions & 0 deletions pingcap-jp/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ class App {
const bannerAnimateEls = Array.from(document.querySelectorAll('.banner-animate'));

bannerAnimateEls.forEach((el) => el.classList.remove('banner-animate'));

document.addEventListener('click', function (event) {
const target = event.target.closest('[data-href]');
if (target) {
const url = target.getAttribute('data-href');
const isExternal =
new URL(url, window.location.origin).origin !== window.location.origin;

if (isExternal) {
window.open(url, '_blank');
} else {
window.location.href = url;
}
}
});
}

async initComponents() {
Expand Down
3 changes: 2 additions & 1 deletion pingcap-jp/templates/page-tidb-user-day-summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<main class="tmpl-summary__content">
<div class="contain">
<h1 class="tmpl-summary__content-title">NewSQLデータベースは<br>もう冒険じゃない</h1>
<a class="button" href="/tidb-user-day/jul-2024/">アーカイブ動画を視聴する</a>
<a class="button" href="/tidb-user-day/jul-2024/">TiUD2024アーカイブ動画を見る</a>
<P class="tip">次回のイベントは2025年10月3日(金)に開催します</P>
</div>
</main>
<section class="bg-black block-container block-columns" id="about">
Expand Down

0 comments on commit d7e25e0

Please sign in to comment.