Skip to content

Commit

Permalink
Feat/modernize (#50)
Browse files Browse the repository at this point in the history
* feat: modernize

* feat: saas

* feat: slides public
xuliwenwenwen authored Dec 4, 2024
1 parent 52af1fc commit ec1ce34
Showing 18 changed files with 892 additions and 649 deletions.
4 changes: 2 additions & 2 deletions pingcap-jp/bootstrap/blocks.php
Original file line number Diff line number Diff line change
@@ -114,8 +114,8 @@
'case-study' => ['block-bg-none'],
'columns' => ['block-bg-none', 'bg-white', 'bg-black', 'bg-black-dark', 'bg-black-gradient', 'bg-blue', 'bg-gray', 'block-bg-image', 'bg-gradient', 'bg-color-gradient'],
'community-activities' => ['block-bg-none'],
'cta' => ['block-bg-none', 'bg-black', 'bg-black-dark', 'bg-violet', 'bg-red', 'bg-blue-dark', 'bg-green','bg-gray', 'block-bg-image'],
'icon-grid' => ['block-bg-none', 'bg-blue', 'bg-black', 'bg-black-dark', 'bg-gradient'],
'cta' => ['block-bg-none', 'bg-black', 'bg-black-dark', 'bg-violet', 'bg-red', 'bg-blue-dark', 'bg-green', 'bg-gray', 'block-bg-image'],
'icon-grid' => ['block-bg-none', 'bg-blue', 'bg-black', 'bg-black-dark', 'bg-black-gradient', 'bg-gradient'],
'leadership' => ['block-bg-none'],
'logos' => ['block-bg-none', 'bg-black', 'bg-black-dark'],
'media-content' => ['block-bg-none', 'bg-white', 'bg-black', 'bg-black-dark', 'bg-gradient'],
14 changes: 4 additions & 10 deletions pingcap-jp/css/blocks/case.scss
Original file line number Diff line number Diff line change
@@ -78,17 +78,11 @@
transform: translateY(-12px);
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
.button-link {
.button__arrow {
&:after {
background-color: #fff;
&::before {
border-color: #000;
transform: rotate(0);
}
&::after {
top: 0;
border-color: #000;
transform: rotate(45deg);
}
border-radius: 50%;
color: #000;
transform: rotate(45deg);
}
}
}
754 changes: 379 additions & 375 deletions pingcap-jp/css/components/banners/banner-default.scss

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions pingcap-jp/css/components/cards/card-bg.scss
Original file line number Diff line number Diff line change
@@ -11,27 +11,29 @@
&:hover {
transform: translateY(-12px);
.button-link {
.button__arrow {
&:after {
background-color: #fff;
&::before {
border-color: #000;
transform: rotate(0);
}
&::after {
top: 0;
border-color: #000;
transform: rotate(45deg);
}
border-radius: 50%;
color: #000;
transform: rotate(45deg);
}
}
}
&__content {
flex: 1;
margin-bottom: 20px;
font-size: 16px;
font-weight: 300;
line-height: 26px;
color: #fff;
img {
width: 60px;
height: 80px;
}
a,
p {
color: #fff !important;
}
}
&__title {
font-size: 24px;
2 changes: 1 addition & 1 deletion pingcap-jp/css/components/footer.scss
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@

&__language-select {
color: #fff;
display: flex;
display: inline-flex;
align-items: center;
gap: 0.8rem;
padding-bottom: 1rem;
22 changes: 4 additions & 18 deletions pingcap-jp/css/components/header.scss
Original file line number Diff line number Diff line change
@@ -43,17 +43,11 @@ html.mobile-menu-cta-active {
&:hover {
background-color: #87120c;
.button-link {
.button__arrow {
&:after {
background-color: #fff;
&::before {
border-color: #000;
transform: rotate(0);
}
&::after {
top: 0;
border-color: #000;
transform: rotate(45deg);
}
border-radius: 50%;
color: #000;
transform: rotate(45deg);
}
}
}
@@ -95,14 +89,6 @@ html.mobile-menu-cta-active {
.button-link {
color: #000;
}
.button__arrow {
&::before {
border-color: #000;
}
&::after {
border-color: #000;
}
}
&:hover {
a,
.button-link {
15 changes: 11 additions & 4 deletions pingcap-jp/css/iconfont.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 4677496 */
src: local(""), url("#{$fonts-url-base}/fonts/iconfont/iconfont.woff?t=1730186159719") format("woff"),
url("#{$fonts-url-base}/fonts/iconfont/iconfont.woff2?t=1730186159719") format("woff2"),
url("#{$fonts-url-base}/fonts/iconfont/iconfont.ttf?t=1730186159719") format("truetype");
src: local(""), url("#{$fonts-url-base}/fonts/iconfont/iconfont.woff?t=1732527762695") format("woff"),
url("#{$fonts-url-base}/fonts/iconfont/iconfont.woff2?t=1732527762695") format("woff2"),
url("#{$fonts-url-base}/fonts/iconfont/iconfont.ttf?t=1732527762695") format("truetype");
}

[class^="icon-"],
@@ -25,6 +25,14 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-arrow-secondary:before {
content: "\e64c";
}

.icon-arrow:before {
content: "\e64b";
}

.icon-newspaper:before {
content: "\e64a";
}
@@ -232,4 +240,3 @@
.icon-globe:before {
content: "\e617";
}

4 changes: 3 additions & 1 deletion pingcap-jp/css/master.scss
Original file line number Diff line number Diff line change
@@ -162,4 +162,6 @@ Templates
@import "templates/product";
@import "templates/ai";
@import "templates/trust";
@import "templates/operation";
@import "templates/operation";
@import "templates/modernize";
@import "templates/saas";
139 changes: 42 additions & 97 deletions pingcap-jp/css/scaffold/buttons.scss
Original file line number Diff line number Diff line change
@@ -176,8 +176,8 @@ input[type="submit"],

&-group {
display: flex;
flex-wrap: wrap;
gap: 3.2rem;
flex-wrap: wrap;
&.center {
justify-content: center;
}
@@ -199,12 +199,13 @@ input[type="submit"],
display: inline-flex;
align-items: center;
justify-content: center;
width: 15.8rem;
padding: 0 40px 0 14px;
height: 4rem;
border: none;
font-size: 1.7rem;
line-height: 2.5rem;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
background-color: #fff;
color: #000;
@@ -215,37 +216,42 @@ input[type="submit"],
cursor: pointer;

span {
position: relative;
z-index: 1;
color: #000;
transition: color 0.15s ease-in-out;
}

&.sm {
font-size: 15px;
line-height: 2.3rem;
width: 14.6rem;
height: 4rem;
}

&.lg {
width: 23rem;
height: 4rem;
min-width: 23rem;
}

&::before {
content: "";
position: absolute;
bottom: -100%;
left: 0;
right: 0;
bottom: -100%;
width: 34px;
height: 34px;
border-radius: 50%;
top: 0;
margin: auto;
background: #dc150b;
z-index: -1;
width: 30%;
border-radius: 99999px;
background: #dc150b;
transition: 0.5s ease-in-out;
transform: translateY(50%);
}
&::after {
content: "\e64b";
font-family: iconfont !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
position: absolute;
right: 14px;
font-size: 10px;
line-height: 1;
}

&:hover {
@@ -254,14 +260,7 @@ input[type="submit"],
color: #fff;
}
&::before {
bottom: -15px;
transform: scale(8);
}
.button__arrow {
&::before,
&::after {
border-color: #fff;
}
transform: scale(6);
}
}
}
@@ -273,99 +272,45 @@ input[type="submit"],
align-items: center;
font-size: 1.6rem;
font-weight: 500;
padding-right: 32px;
color: #fff;
line-height: 22px;
white-space: noWrap;
text-decoration: none;
transition: all var(--default-transition-params);

.button__arrow {
width: 20px;
height: 20px;
border-radius: 50%;
margin-left: 1rem;
&::after {
content: "\e64c";
font-family: iconfont !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
position: absolute;
right: 0;
font-size: 20px;
padding: 1px;
line-height: 1;
background-color: transparent;
transition: 0.4s ease-in-out;
&::before {
border-color: #fff;
right: 3px;
width: 15px;
transition: 0.2s ease-in-out;
}
&::after {
right: 4px;
top: -4px;
border-color: #fff;
width: 9px;
height: 9px;
transition: 0.2s ease-in-out;
}
transition: transform var(--default-transition-params);
}

&.lg {
font-size: 2.1rem;
.button__arrow {
width: 22px;
height: 22px;
margin-left: 1.2rem;
&::before {
right: 2px;
width: 18px;
}
&::after {
width: 10px;
height: 10px;
}
font-size: 21px;
padding-right: 36px;
&:after {
font-size: 24px;
}
}

&:hover {
.button__arrow {
&:after {
background-color: #fff;
&::before {
border-color: #000;
transform: rotate(0);
}
&::after {
top: 0;
border-color: #000;
transform: rotate(45deg);
}
border-radius: 50%;
color: #000;
transform: rotate(45deg);
}
}
}

.button__arrow {
position: relative;
margin-left: 16px;
width: 8px;
height: 8px;
display: block;
transition: 0.2s ease-in-out;

&::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
right: -1px;
width: 10px;
height: 0px;
border-top: 1px solid #000;
transform: rotate(-45deg);
margin: auto;
}

&::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
right: 0;
width: 8px;
height: 8px;
border-top: 1px solid #000;
border-right: 1px solid #000;
margin: auto;
}
display: none;
}
34 changes: 13 additions & 21 deletions pingcap-jp/css/templates/front-page.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.tmpl-front-page {
background-color: #000;

.deploy {
background: linear-gradient(180deg, #06111a 55.9%, #000000 100%);
.contain {
@@ -122,17 +124,11 @@
&:hover {
transform: translateY(-12px);
.button-link {
.button__arrow {
&:after {
background-color: #fff;
&::before {
border-color: #000;
transform: rotate(0);
}
&::after {
top: 0;
border-color: #000;
transform: rotate(45deg);
}
border-radius: 50%;
color: #000;
transform: rotate(45deg);
}
}
}
@@ -220,15 +216,11 @@
text-decoration: none;
cursor: pointer;
&:hover {
.button__arrow {
background-color: #fff;
&::before {
border-color: #000;
transform: rotate(0);
}
&::after {
top: 0;
border-color: #000;
.button-link {
&:after {
background-color: #fff;
border-radius: 50%;
color: #000;
transform: rotate(45deg);
}
}
@@ -274,7 +266,7 @@
color: #5d6974;
}
}
.text-right{
.text-right {
display: block;
}
}
@@ -314,7 +306,7 @@
height: auto;
}
a {
color: #fff!important;
color: #fff !important;
}
.hs-button {
letter-spacing: 0;
75 changes: 75 additions & 0 deletions pingcap-jp/css/templates/modernize.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.tmpl-modernize {
&__scale {
background: linear-gradient(180deg, #06111a 0%, #000000 100%);
.block-columns__column {
@include media-min($large) {
display: flex;
gap: 50px;
.block-title {
flex: 1;
}
.cards {
flex: 1.5;
}
}
}
.cards {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 80px 50px;
align-self: flex-start;
margin-top: 32px;
.card {
flex: 1;
font-size: 24px;
font-weight: 700;
line-height: 30px;
text-align: left;
color: #5d6974;
}
h3 {
font-size: 40px;
line-height: 48px;
font-weight: 700;
letter-spacing: -0.08em;
text-align: left;
color: #1aa8a8;
@include media-min($medium) {
font-size: 64px;
line-height: 70px;
}
}
}
}
&__proven {
.block-title {
@include media-min($large) {
display: flex;
gap: 32px;
.desc {
margin-top: 32px;
}
}
}
.cards {
@include media-min($medium) {
display: flex;
}
margin-bottom: 80px;
}
.card {
border: 1px solid #2f353a;
padding: 24px 24px 40px 24px;
flex: 1;
img {
margin-bottom: 24px;
}
p {
color: #a2adb9;
font-size: 16px;
font-weight: 300;
line-height: 24px;
}
}
}
}
245 changes: 245 additions & 0 deletions pingcap-jp/css/templates/saas.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
.tmpl-saas {
&__banner {
background-color: #000;
background-size: contain;

@include media-min($xlarge) {
background-size: cover;
}
@include media-min($large) {
.banner-default__text-content--center {
padding-top: 120px;
padding-bottom: 200px;
grid-column: 3 / span 8;
}

h1 {
font-size: 72px;
line-height: 86px;
}
}
p {
font-weight: 300;
text-align: center;
color: #a2adb9;
margin-left: auto;
margin-right: auto;
@include media-min($large) {
font-size: 26px;
line-height: 34px;
}
+ p {
margin-top: 36px;
}
}
}
&__logo {
h2 {
font-size: clamp(30px, 3.25vw, 36px);
}
@include media-min($large) {
.block-logos__logo {
width: 74%;
margin: auto;
}
.block-logos__logo-grid {
grid-template-columns: repeat(5, 1fr);
}
}
}
&__icon-grid {
@include media-min($large) {
.block-icon-grid__item-container {
margin: auto;
width: 80%;
}
}
.block-icon-grid__item {
p {
color: #a2adb9;
}
}
}
&__feature {
.block-inner {
@include media-min($large) {
display: flex;
gap: 64px !important;
}
.block-section__title-container {
flex: 1;
display: block;
h2 {
font-size: 40px;
font-weight: 700;
line-height: 48px;
@include media-min($medium) {
font-size: 60px;
line-height: 74px;
text-align: left;
}
}
}
.block-section__title-desc {
font-size: 22px;
font-weight: 300;
line-height: 28px;
text-align: left;
color: #5d6974;
margin-top: 32px;
}
.block-icon-grid__item-container {
flex: 2;
}
}
}
&__compare {
.block-title {
@include media-min($large) {
display: flex;
gap: 64px;
.desc {
width: 100%;
}
> div,
h4 {
flex: 1;
}
}
h4 {
margin-top: 0;
}
}
.table {
overflow: hidden;
overflow-x: auto;
display: flex;
.row {
color: #fff;
flex: 1;
min-width: 140px;
div {
height: 64px;
display: flex;
align-items: center;
font-size: 16px;
font-weight: 500;
line-height: 22px;
text-align: center;
justify-content: center;
padding: 20px 5px;
background: #000;
&:nth-of-type(even) {
background: #07121a;
}
&:first-child {
height: 68px;
}
}
&:first-child {
flex: 1.8;
position: sticky;
left: 0;
z-index: 1;
div {
font-size: 20px;
font-weight: 500;
line-height: 22px;
text-align: left;
justify-content: flex-start;
}
}
&:last-child {
border-radius: 6px;
border: 2px solid transparent;
overflow: hidden;
position: relative;
div {
background: rgba(1, 84, 87);
&:nth-of-type(even) {
background: #004043;
}
&::after {
content: "";
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 2px;
border: 2px solid;
border-image: linear-gradient(180deg, #18ffc9 0%, #22a62a 100%) 1;
}
}
}
.line {
position: relative;
&:after {
content: "";
position: absolute;
width: 10px;
height: 1px;
background: #414b52;
}
}
}
}
.table-tip {
color: #a2adb9;
font-size: 16px;
font-weight: 300;
line-height: 22px;
text-align: right;
margin-top: 20px;
@include media-min($medium) {
display: none;
}
}
}
&__customers {
background: linear-gradient(358.26deg, #ffffff 3.54%, #dde2e6 100.25%);
.cards {
--num-cols: 1;

display: grid;
grid-template-columns: repeat(var(--num-cols), 1fr);
gap: var(--grid-column-gutter);

@include media-min($medium) {
--num-cols: 2;
}

@include media-min($large) {
--num-cols: 3;
}
}
.card {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 3rem 3.2rem 3.2rem;
text-decoration: none;
border: 1px solid var(--card-border-color);
border-radius: var(--card-border-radius);
transition: all var(--default-transition-params);
cursor: pointer;
&-content {
flex: 1;
margin-bottom: 30px;
}
img {
margin-bottom: 48px;
height: 43px;
width: auto;
}
p {
font-size: 16px;
font-weight: 300;
line-height: 24px;
}
&:hover {
box-shadow: var(--card-box-shadow);
transform: var(--card-transform);
}
}
}
}
Binary file modified pingcap-jp/fonts/iconfont/iconfont.ttf
Binary file not shown.
Binary file modified pingcap-jp/fonts/iconfont/iconfont.woff
Binary file not shown.
Binary file modified pingcap-jp/fonts/iconfont/iconfont.woff2
Binary file not shown.
204 changes: 96 additions & 108 deletions pingcap-jp/js/blocks/carousel.js
Original file line number Diff line number Diff line change
@@ -1,113 +1,101 @@
import { loadEmblaCarousel } from "../util/load-dependencies";
import { enableNavButtons } from "../util/embla/util";
import EmblaPagination from "../util/embla/pagination";
import SiteEvents, { SiteEventNames } from "../util/site-events";
import EmblaAutoplay, { stopAutoplayOnHover } from "../util/embla/autoplay";
import ClassNames from "embla-carousel-class-names";
import { loadEmblaCarousel } from '../util/load-dependencies';
import { enableNavButtons } from '../util/embla/util';
import EmblaPagination from '../util/embla/pagination';
import SiteEvents, { SiteEventNames } from '../util/site-events';
import EmblaAutoplay, { stopAutoplayOnHover } from '../util/embla/autoplay';

class BlockCarousel {
constructor(el) {
this.el = el;
this.emblaInitialized = false;

this.initEmbla();
}

async initEmbla() {
// skip the initialization if the initilialized flag has already been set
if (this.emblaInitialized) {
return;
}

try {
const EmblaCarousel = await loadEmblaCarousel();
const emblaRootEl = this.el.querySelector(".embla-instance");

if (!emblaRootEl) {
return;
}

const emblaEl = emblaRootEl.querySelector(".embla");
const btnPrevEl = Array.from(
this.el.querySelectorAll(".embla__nav-button--prev")
);
const btnNextEl = Array.from(
this.el.querySelectorAll(".embla__nav-button--next")
);
const paginationEl = this.el.querySelector(".embla__pagination");

const transitionSpeed = emblaRootEl
? parseInt(emblaRootEl.getAttribute("data-transition-speed") || 10, 10)
: 10;

const autoplayEnabled = emblaRootEl
? parseInt(emblaRootEl.getAttribute("data-autoplay-enabled") || 1, 10)
: 1;

const autoplaySpeed = emblaRootEl
? parseInt(emblaRootEl.getAttribute("data-autoplay-speed") || 4000, 10)
: 4000;

const instance = {
embla: EmblaCarousel(
emblaEl,
{
loop: autoplayEnabled,
speed: transitionSpeed,
containScroll: "keepSnaps",
draggable: false,
},
[ClassNames()]
),
pagination: null,
autoplay: autoplayEnabled,
};

if (instance.embla) {
instance.embla.on("init", (a, b, c) => {
SiteEvents.publish(SiteEventNames.IMAGEBUDDY_TRIGGER_UPDATE);
this.setBackgroundColor();
});

instance.embla.on("select", (a, b, c) => {
this.setBackgroundColor();
});

if (btnPrevEl && btnNextEl) {
enableNavButtons(instance.embla, btnPrevEl, btnNextEl);
}

if (paginationEl) {
instance.pagination = new EmblaPagination(
instance.embla,
paginationEl,
{
buttonClassName: "embla__pagination-button",
}
);
}

if (autoplayEnabled) {
instance.autoplay = new EmblaAutoplay(instance.embla, autoplaySpeed);

stopAutoplayOnHover(emblaRootEl, instance.autoplay, 2000);
}
}

this.emblaInitialized = true;
} catch (err) {
console.error("Embla Carousel dynamic import failed", err);
}
}

setBackgroundColor() {
const color = this.el
.querySelector(".is-snapped")
.getAttribute("data-color");
if (color) {
this.el.style.backgroundColor = color;
}
}
constructor(el) {
this.el = el;
this.emblaInitialized = false;

this.initEmbla();
}

async initEmbla() {
// skip the initialization if the initilialized flag has already been set
if (this.emblaInitialized) {
return;
}

try {
const EmblaCarousel = await loadEmblaCarousel();
const emblaRootEl = this.el.querySelector('.embla-instance');

if (!emblaRootEl) {
return;
}

const emblaEl = emblaRootEl.querySelector('.embla');
const emblaSlideEl = Array.from(this.el.querySelectorAll('.embla__slide'));
const btnPrevEl = Array.from(this.el.querySelectorAll('.embla__nav-button--prev'));
const btnNextEl = Array.from(this.el.querySelectorAll('.embla__nav-button--next'));
const paginationEl = this.el.querySelector('.embla__pagination');

const transitionSpeed = emblaRootEl
? parseInt(emblaRootEl.getAttribute('data-transition-speed') || 10, 10)
: 10;

const autoplayEnabled = emblaRootEl
? parseInt(emblaRootEl.getAttribute('data-autoplay-enabled') || 1, 10)
: 1;

const autoplaySpeed = emblaRootEl
? parseInt(emblaRootEl.getAttribute('data-autoplay-speed') || 4000, 10)
: 4000;

const loop = emblaSlideEl.length > 2 ? autoplayEnabled : false;

const instance = {
embla: EmblaCarousel(emblaEl, {
loop,
speed: transitionSpeed,
containScroll: 'keepSnaps',
draggable: false
}),
pagination: null,
autoplay: autoplayEnabled
};

if (instance.embla) {
instance.embla.on('init', () => {
SiteEvents.publish(SiteEventNames.IMAGEBUDDY_TRIGGER_UPDATE);
this.setBackgroundColor();
});

instance.embla.on('select', () => {
this.setBackgroundColor();
});

if (btnPrevEl && btnNextEl) {
enableNavButtons(instance.embla, btnPrevEl, btnNextEl);
}

if (paginationEl) {
instance.pagination = new EmblaPagination(instance.embla, paginationEl, {
buttonClassName: 'embla__pagination-button'
});
}

if (autoplayEnabled) {
instance.autoplay = new EmblaAutoplay(instance.embla, autoplaySpeed);

stopAutoplayOnHover(emblaRootEl, instance.autoplay, 2000);
}
}

this.emblaInitialized = true;
} catch (err) {
console.error('Embla Carousel dynamic import failed', err);
}
}

setBackgroundColor() {
const color = this.el.querySelector('.is-selected').getAttribute('data-color');
if (color) {
this.el.style.backgroundColor = color;
}
}
}

export default BlockCarousel;
4 changes: 2 additions & 2 deletions pingcap-jp/post-types/slides.php
Original file line number Diff line number Diff line change
@@ -7,12 +7,12 @@
[
'label' => $plural_label,
'description' => '',
'public' => false,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'capability_type' => 'page',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => [
3 changes: 3 additions & 0 deletions pingcap-jp/templates/single-slides.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
wp_redirect(get_post_type_archive_link(PingCAP\Constants\CPT::SLIDES));
exit;

0 comments on commit ec1ce34

Please sign in to comment.