Skip to content

Commit c6d76f1

Browse files
authored
Merge pull request #4650 from JetBrains/ktl-1648-hero-banner
feat: added ktor banner to hero section
2 parents d0aea34 + e9c1bb7 commit c6d76f1

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

blocks/main/hero/hero.module.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,58 @@
108108
}
109109

110110
}
111+
112+
.banner {
113+
display: none;
114+
position: relative;
115+
justify-content: space-between;
116+
margin-top: 40px;
117+
width: 545px;
118+
padding: 16px 16px 16px 24px;
119+
box-sizing: border-box;
120+
border-radius: 24px;
121+
background-color: rgba(126, 66, 255, 0.40);
122+
overflow: hidden;
123+
124+
.bannerContent {
125+
text-align: left;
126+
}
127+
128+
.bannerTitle {
129+
margin: 0;
130+
letter-spacing: 0.01em;
131+
}
132+
133+
.bannerCaption {
134+
margin: 0;
135+
color: white;
136+
letter-spacing: 0.01em;
137+
}
138+
139+
.bannerButton {
140+
align-self: flex-end;
141+
}
142+
}
143+
144+
.banner:before {
145+
content: "";
146+
position: absolute;
147+
right: 0;
148+
top: 0;
149+
width: 198px;
150+
height: 100px;
151+
background-image: url("/images/main/hero-banner-gradient.svg");
152+
}
153+
}
154+
155+
:global(.ab-hero-ktor) {
156+
.banner {
157+
display: flex;
158+
159+
@media (--ktl-ds) {
160+
display: none;
161+
}
162+
}
111163
}
112164

113165
.heroText {

blocks/main/hero/hero.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import cn from 'classnames';
44

55
import { useTextStyles, createTextCn } from '@rescui/typography';
66
import { ThemeProvider } from '@rescui/ui-contexts';
7+
import heroBannerDataRaw from '../../../data/hero-banner.yml';
78

89
import Image from 'next/image';
910

@@ -20,6 +21,16 @@ interface Props {
2021
children: ReactNode;
2122
}
2223

24+
type HeroBannerData = {
25+
isActive: boolean;
26+
title: string;
27+
caption: string;
28+
buttonLabel: string;
29+
buttonUrl: string;
30+
}
31+
32+
const heroBannerData = heroBannerDataRaw as HeroBannerData;
33+
2334
export const HeroSection: FC<Props> = ({ children, title }) => {
2435
const textCn = useTextStyles();
2536
const darkTextCn = createTextCn('dark');
@@ -51,6 +62,14 @@ export const HeroSection: FC<Props> = ({ children, title }) => {
5162
</a>
5263
</div>
5364
</div>
65+
{heroBannerData.isActive && <div className={styles.banner}>
66+
<div className={styles.bannerContent}>
67+
<h5 className={cn(darkTextCn('rs-h2'), styles.bannerTitle)}>{heroBannerData.title}</h5>
68+
<p className={cn(darkTextCn('rs-text-2'), styles.bannerCaption)}>{heroBannerData.caption}</p>
69+
</div>
70+
<Button mode="outline" size="m" href={heroBannerData.buttonUrl}
71+
className={styles.bannerButton}>{heroBannerData.buttonLabel}</Button>
72+
</div>}
5473
</div>
5574
</div>
5675

data/hero-banner.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
isActive: true
2+
title: "Ktor 3.0 Is Out"
3+
caption: "Now it’s even easier to write in Kotlin"
4+
buttonLabel: "Try Now"
5+
buttonUrl: "https://kotl.in/6xp3v8"
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)